Install Homebrew and the Latest Git on your Mac
We use a software called Homebrew to facilitate the installation of various tools that we use on a daily basis. This page will show you how to install Homebrew on your system and how to install the latest version of Git from Homebrew.
Clone the Git repo into your home folder
cd ~
git clone https://github.com/Homebrew/brew.git
Set Up your Path
It’s important that your Terminal knows where the new version of Git is. The procedure for this depends on which shell you’re using. You’re probably using zsh
, but if you’re unsure which shell you’re using, run echo $SHELL
.
If you use Bash, run
echo 'export PATH=${HOME}/brew/bin:${PATH}' >> ~/.bash_profile
source ~/.bash_profile
If you use Zsh, run
echo 'export PATH=${HOME}/brew/bin:${PATH}' >> ~/.zshrc
source ~/.zshrc
Now, run these last few commands to clean things up and get homebrew ready.
which brew
brew update
brew doctor
Test it out: Install Git
Now that you have Homebrew installed, we can test to see if it’s working by installing the latest version of Git. Run these commands in your Terminal:
brew install git
which git
You should see something like /Users/ab123456/brew/bin/git
(where ab123456
is your NID)
You’re done! You can now install all kinds of things through Homebrew! Note: If you got to this page from the ‘version-control’ training page, hitch a ride back!