NOTE: This post is a few years old and may be outdated, but I did just install the following on a new iMac M1 in 2022 and here’s what worked:
First, Git comes installed by default on most Mac and Linux machines.
To check if you have Git installed, open your Terminal and type
git --version
Hit return. If you don’t see a Git version follow these instructions to install Git on your Mac: https://git-scm.com/install/mac
Then configure Git with your email and name:
git config --global user.email "your@email.com"
git config --global user.name "Your Name"
Before installing Homebrew, you should ensure the Apple Command Line Tools are installed:
xcode-select --install
Then install Homebrew (see https://brew.sh/ for more detail, but this will get you there):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Add Homebrew to your PATH:
echo 'eval $(/opt/homebrew/bin/brew shellenv)' >> $HOME/.zprofile
eval "$(/opt/homebrew/bin/brew shellenv)"
Then restart your Terminal and run the following commands:
brew doctor
brew update
brew install git php composer wget
Bonus: Generate a Modern SSH Key
In 2026, we recommend using Ed25519 instead of the older RSA format. It is more secure, generates shorter strings, and is supported by virtually all modern hosting providers (GitHub, GitLab, Bitbucket, etc.).
1. Generate the key:
Open your Terminal and run the following command, replacing the email with your own:
ssh-keygen -t ed25519 -C "your@email.com"
When prompted to “Enter a file in which to save the key,” just hit Return to use the default location.
2. Add your key to the SSH Agent:
To ensure macOS remembers your key and doesn’t ask for your passphrase every time you reboot, run:
eval "$(ssh-agent -s)"
3. Configure your SSH config file:
Modern macOS versions require a small configuration change to persist the key in your Apple Keychain. Open (or create) your config file:
nano ~/.ssh/config
Paste the following into the file:
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_ed25519
(Press Control+O, then Return to save, and Control+X to exit).
4. Add the key to your Keychain:
ssh-add --apple-use-keychain ~/.ssh/id_ed25519
5. Copy the key to your clipboard:
Finally, copy your public key so you can paste it into GitHub or your server dashboard:
pbcopy < ~/.ssh/id_ed25519.pub
The key is now on your clipboard and ready to be pasted!