github-desktop/docs/contributing/setup-macos.md

93 lines
2.8 KiB
Markdown
Raw Normal View History

2018-09-13 16:16:49 +00:00
# Setting Up Development Dependencies on macOS
2018-09-03 18:28:44 +00:00
2018-09-13 14:42:45 +00:00
You will need to install these tools on your machine:
- Node.js v8.11.4
- Python 2.7
- Xcode and Xcode Command Line Tools (Xcode -> Preferences -> Downloads)
2018-09-10 20:22:57 +00:00
## Node.js
2018-09-03 18:28:44 +00:00
Let's see if you have the right version of `node` installed. Open a terminal and run this command inside the Desktop source directory:
2018-09-03 18:28:44 +00:00
```shellsession
$ node -v
```
2018-09-03 18:28:44 +00:00
If you see an error about being unable to find `node`, that probably means you don't have any Node tools installed. You can install Node LTS (the version we need) from the [Node.js website](https://nodejs.org/en/download/) and restart your shell.
2018-09-03 18:28:44 +00:00
If you see the output `v8.11.x` (where `x` is any number), you're good to go.
2018-09-03 18:28:44 +00:00
If you see the output `v10.x.y` you're ahead of what we currently support. We have an outstanding issue building GitHub Desktop with Node 10, and hopefully can resolve this soon. If you don't care about the version you are running, you can install the version from the [Node.js website](https://nodejs.org/en/download/) over the top of your current install.
2018-09-14 20:22:58 +00:00
### I need to use different versions of Node.js in different projects!
2018-09-03 18:28:44 +00:00
We currently support these Node version managers: `nvm` and `asdf-nodejs`.
#### Configuring `nvm`
1. Install `nvm` using the instructions [here](https://github.com/creationix/nvm#install-script).
2. Within the Desktop source directory, install version of Node.js it requires:
```shellsession
$ nvm install
```
3. Ensure you are running the right version
```shellsession
$ nvm use
```
4. Verify you have the right version by running `node -v` again
```shellsession
$ node -v
```
If you see `v8.11.4`, you're good to go.
#### Configuring `asdf-nodejs`
`asdf` is a little more involved to install. Follow the instructions [here](https://github.com/asdf-vm/asdf) and [here](https://github.com/asdf-vm/asdf-nodejs)
2018-09-04 00:53:54 +00:00
## Python
2018-09-19 19:24:47 +00:00
macOS comes with Python pre-installed, and it happens to be the right version, so you're probably fine! But let's be sure. Open a terminal and run this command inside the Desktop source directory:
2018-09-04 00:53:54 +00:00
2018-09-19 19:24:47 +00:00
```shellsession
$ python --version
```
If you see the output `Python 2.7`, you're good to go.
### I need to use different versions of Python in different projects!
2018-09-04 00:53:54 +00:00
2018-09-14 20:22:58 +00:00
For this, we recommend [pyenv](https://github.com/pyenv/pyenv). (It's the only game in town.)
2018-09-19 19:24:47 +00:00
1. Install pyenv according to https://github.com/pyenv/pyenv-installer#github-way-recommended
2. Within the Desktop source directory, install version of Python it requires:
```shellsession
pyenv install
```
3. Verify you have the right version by running `python --version` again
2018-09-04 00:53:54 +00:00
2018-09-19 19:24:47 +00:00
```shellsession
$ python --version
```
2018-09-04 00:53:54 +00:00
2018-09-19 19:24:47 +00:00
If you see the output `Python 2.7`, you're good to go.
2018-09-10 20:22:57 +00:00
## Xcode Command Line Tools
2018-09-19 19:24:47 +00:00
1. Run this command to install the Xcode command line tools. If you already have them, it'll say so!
```shellsession
xcode-select --install
```