Setting Up Development Dependencies on macOS
You will need to install these tools on your machine:
- Node.js
- Yarn
- Python 3
- Xcode and Xcode Command Line Tools (Xcode -> Preferences -> Downloads)
Node.js
Let's see if you have the right version of node
installed. Open a terminal and run this command inside the Desktop
source directory:
$ node -v
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, install the package, and restart your shell.
You can verify that your installed version matches the one currently used by GitHub Desktop by looking at our .node-version file. Usually the same major version is enough but if you're running into problems building Desktop please try installing that exact version.
I need to use different versions of Node.js in different projects!
We currently support these Node version managers: nvm
and asdf-nodejs.
Configuring nvm
Install
nvmusing the instructions here.Within the Desktop source directory, install version of Node.js it requires:
$ nvm install
- Ensure you are running the right version:
$ nvm use
- Verify you have the right version by running
node -vagain:
$ node -v
If you see any version number, you're good to go.
Configuring
asdf-nodejs
asdf is a little more involved to install. Check out the
instructions here and here for more
information.
Yarn
Follow this
guide 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 to help
familiarize yourself with how to do the common package tasks that are
relevant to Desktop.
Python
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:
$ python3 --version
If you see the output Python 3.9.x, you're good to
go!
I need to use different versions of Python in different projects!
For this, we recommend pyenv. (It's the only game in town.)
Install pyenv according to the instructions.
Within the Desktop source directory, install version of Python it requires:
pyenv install
- Verify you have the right version by running
python3 --versionagain:
$ python3 --version
If you see the output Python 3.9.x, you're good to
go!
Xcode Command Line Tools
Run this command to install the Xcode command line tools.
xcode-select --install
If you already have them, it'll say so!
Back to setup
Once you've installed the necessary dependencies, head back to the setup page to finish getting set up.