How to install Homebrew, Composer, Git and WGET on Mac OSX High Sierra, Mojave, Catalina, Big Sur, Monterey

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 computer:
https://git-scm.com/book/en/v2/Getting-Started-Installing-Git

Then configure Git with your email and name:

git config --global user.email "your@email.address"

git config --global user.name "Your Name"

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)"

If you are using a new Mac M1 you’ll need to add Homebrew to your PATH so run:

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 update

brew upgrade

brew help

brew install git composer php

brew install wget

Bonus: Generate a 4096 bit SSH key (more secure than 2048 or 1024 bit keys)

ssh-keygen -t rsa -b 4096 -C "tim@div.digital"

cat ~/.ssh/id_rsa.pub

eval `ssh-agent`

ssh-add ~/.ssh/id_rsa

pbcopy < ~/.ssh/id_rsa.pub

Paste into TextEdit or add a new SSH keys to Github or your hosting dashboard.

Restart Terminal.