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

111 lines
3.3 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:
2018-11-09 20:44:35 +00:00
- Node.js v8.12.0
- Yarn
2018-09-13 14:42:45 +00:00
- 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 download Node from the [Node.js website](https://nodejs.org/), install the package, and restart your shell.
2018-09-03 18:28:44 +00:00
If you see the output `v10.x.y`, you're good to go.
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
```
2018-09-19 20:13:31 +00:00
3. Ensure you are running the right version:
```shellsession
$ nvm use
```
2018-09-19 20:13:31 +00:00
4. Verify you have the right version by running `node -v` again:
```shellsession
$ node -v
```
If you see any version number, you're good to go.
#### Configuring `asdf-nodejs`
2018-09-19 20:13:31 +00:00
`asdf` is a little more involved to install. Check out the instructions [here](https://github.com/asdf-vm/asdf) and [here](https://github.com/asdf-vm/asdf-nodejs) for more information.
2018-09-04 00:53:54 +00:00
## Yarn
Follow [this guide](https://yarnpkg.com/en/docs/install#mac-stable) to install
a system-level `yarn`. GitHub Desktop uses a local version of `yarn`, but it
needs a version on your `PATH` to bootstrap itself.
This is important because `yarn` uses lock files to pin dependencies. If you
find yourself changing packages, this will prevent mismatches in versions
between machines.
If you're not familiar with `yarn`, please read [this document](./working-with-packages.md)
to help familiarize yourself with how to do the common package tasks that are
relevant to Desktop.
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.x`, you're good to go!
2018-09-19 19:24:47 +00:00
### 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 20:13:31 +00:00
1. Install pyenv according to [the instructions](https://github.com/pyenv/pyenv-installer#github-way-recommended).
2018-09-19 19:24:47 +00:00
2. Within the Desktop source directory, install version of Python it requires:
```shellsession
pyenv install
```
2018-09-19 20:13:31 +00:00
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 20:13:31 +00:00
If you see the output `Python 2.7.x`, you're good to go!
2018-09-10 20:22:57 +00:00
## Xcode Command Line Tools
2018-09-19 20:13:31 +00:00
Run this command to install the Xcode command line tools.
2018-09-19 19:24:47 +00:00
```shellsession
xcode-select --install
```
2018-09-19 20:13:31 +00:00
If you already have them, it'll say so!
## Back to setup
Once you've gotten all the necessary dependencies, head back to the [setup page](https://github.com/desktop/desktop/blob/development/docs/contributing/setup.md) to finish getting set up.