Skip to main content

Macs

This document provides details on how to set up CRUK-managed MacBooks.

Admin Access

Admin access is a must. If you want to run sudo commands or update your /etc/hosts file, you need admin access. For some unfathomable reason, developer laptops are not provided with admin access as standard. You will need to create a ticket in Service Now and have it authorised by your line manager for EUC support (End User Computing) to enable your admin access. They can do this fairly quickly and remotely; they may require you to restart your machine. Then, add your fingerprint to Touch ID in system settings.

Xcode & Command Line Tools

When installing Xcode from the App Store, disable Windows Defender, restart your machine, download Xcode, and re-enable it after installation. After downloading, installation can take 3–5 hours (ridiculous, I know). Just leave it running. Alternatively, if only the Xcode Command Line Tools are needed (a requirement for Git, Homebrew, etc.), you can simply install Homebrew, and you will be prompted with the option to install Xcode Command Line Tools.

Vagrant

If installing Vagrant, you may run into issues with IP ranges. You need to use sudo commands to create the directories and file required below:

/etc/vbox/networks.conf

Add the following to that file (be careful—blank spaces will break the file):

* 10.0.0.0/8 192.168.0.0/16
* 2001::/64

See Setting up Vagrant for hosts-only networking.

Enabling NFS

If you want to use NFS, you need to stop the firewall of the endpoint client for CheckPoint VPN from blocking it. Run:

sudo rm -rf /Library/Extensions/cpfw.kext

NFS will probably still be blocked until a restart.

Terminal

zsh is now the default terminal for Macs, replacing bash.
ohmyzsh is recommended as a way to manage plugins for zsh.
See ohmyzsh.

Inside your .zshrc file, you might have something that looks like this:

plugins=(
git
zsh-autosuggestions
zsh-syntax-highlighting
)

See ohmyzsh plugins list.

iTerm2 is an improvement on the default terminal, allowing for tabs and split-screen views.
See iTerm2.

See Setting up terminal guide (Note: This is now a Medium members-only article and requires a Medium account & subscription).

Homebrew

For everything that you can't get from the App Store, Homebrew is the de facto package manager for Macs. To install brew, run the following in the terminal:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Now you can start using brew to install plugins, libraries, and applications. For example:

brew install wget

See Homebrew.

Node and nvm

It is highly likely that you will need the Node runtime to do any web development. It is highly recommended not to install Node but to install nvm (Node Version Manager) via brew. To use brew, setting up XCode as mentioned above is a prerequisite.

brew install nvm

This is because different repos might depend on different versions of Node, and nvm gives you the ability to select different versions of Node on the fly. For example, to install and use Node 18:

nvm install 18
nvm use 18

See nvm.

Husky + nvm

Husky is a Node module that can universally, across different operating systems, set up Git hooks for your repo. For example, it ensures it runs through specified linting checks before you commit your code. The reason why it is in this guide is that there are certain hoops to jump through if you want this tool to work with tools like VS Code or SourceTree and nvm together if you use them to control your commits.

First, create a new file:

touch ~/.huskyrc

And inside, add:

#!/usr/bin/env bash

source ~/.zshrc

if test -f ".nvmrc"; then
nvm use
fi

Add the following to your .zshrc file:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

Passwords in Terminal

To streamline authentication in the terminal, you can enable Touch ID for sudo commands. This reduces the need to repeatedly enter your password, especially during tasks like managing multiple virtual machines in Vagrant.

To enable Touch ID, edit /etc/pam.d/sudo (requires sudo access) and add the following line at the top of the file:

auth sufficient pam_tid.so

If using iTerm2, configure it to preserve sessions after logging out. Go to Settings -> Advanced -> Allow sessions to survive logging out and enable the option.

This setup ensures smoother and persistent terminal authentication.