Installing a Mac development environment
NAGRA recommends using Mac for development purposes.
Xcode
Installing Xcode
Download Xcode from the App Store and install using the command-line tools.
xcode-select --install
If you need to update Xcode, do this afterwards as it often breaks. You can use Xcode to install the CLI as well.
Installing Xcode packages
Start Xcode and install anything requested. Create a default project and build the simulator to get at least one simulator installed and set up.
CocoaPods
Install the latest version of CocoaPods.
sudo gem install cocoapods
- Podfile.lock contains the version of cocoapods at enddownloaded and executed when the command is run.
If you are installing on Apple devices containing the new M1 chip, you will need to run pod install.
CODEarch -x86_64 pod install
Homebrew
The Homebrew package manager is required for Mac installations. You should close and open a new command line after each installation.
Installing Homebrew
Homebrew is available at https://brew.sh; follow the installation instructions.
Homebrew installs to a new location for machines with Apple Silicon instead of Intel. Older packages that require Homebrew in the old location will break.
If you see the following error during installation or when updating or upgrading, you will need to reinstall the Xcode CLI (see above).
CODEError: python@3.8: the bottle needs the Apple Command Line Tools to be installed.
If you get the brew shallow version warnings/errors, follow the on-screen instructions to fix brew first.
CODEgit -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow
You should then be able to update (brew update
) and/or upgrade (brew upgrade
).
brew list
- gets a list of installed itemsbrew install x [-v n.n.n]
brew uninstall x
Installing packages using Homebrew
Following on, install the following Homebrew packages:
Node
(brew install node
) - Currently installs Node 16.
NVM
Click https://github.com/nvm-sh/nvm and follow the readme for instructions.
nvm list
- Shows all versions of Node that NVM recognisesnvm install x
nvm use x
nvm alias default x
- Default version to use; packages installed via brew might ignore this.
There may be more versions of Node installed via brew than NVM uses.
Watchman
(brew install watchman
)
If this does not work or you experience issues with Watchman, use brew install watchman
to uninstall and redo manually. The usual problem is that brew install fails to make the directory.
unzip watchman-*-linux.zip
sudo mkdir -p /usr/local/{bin,lib} /usr/local/var/run/watchman
sudo cp bin/* /usr/local/bin
sudo cp lib/* /usr/local/lib
sudo chmod 755 /usr/local/bin/watchman
sudo chmod 2777 /usr/local/var/run/watchman
Yarn
(brew install yarn
)
Yarn installs against a default version of Node, usually the one initially installed. You can change the version Yarn runs against in a command session by changing the Node version with NVM. However, the Jenkins process defaults to the version Yarn was installed against. This is important as some dependencies may require a different version to the one used to install Yarn. If you have problems with Node versions running Yarn via Jenkins, you may have to uninstall Yarn, change the desired Node version and reinstall Yarn.
Yarn might use a default version installed when being run via Jenkins. If so, uninstall, set the version of Node you need and then reinstall Yarn.
JDK
Install the JDK for Android and Gradle (not React).
brew tap AdoptOpenJDK/openjdk
brew install --cask adoptopenjdk8 (or whatever version you want)
Apple Silicon can run old versions of JDK for x86 using Rosetta (although there could be issues).