there are many ways to install git on a mac and you may already have it installed. If you are not sure, open a terminal, type git --version, and press enter. If you get a version number, you are good to go. If not, follow one the installation paths below.
GitHub Desktop (easiest)
GitHub Desktop is a GUI for git that makes it easy to manage your git repositories. It will install git for you if it is not already installed.
- Go to desktop.github.com
- Click the Download for macOS button
- Open the downloaded file
- move the GitHub Desktop icon to the Applications folder
- open GitHub Desktop from your Applications folder
- Click Sign in if you already have a GitHub account, or click Create account to create one
- You're all set!
Homebrew
Homebrew is a package manager for macOS. It allows you to install and manage software packages from the command line.
- check if homebrew is installed by opening a terminal, typing
brew --version, and pressing enter. If you get a version number, skip to step 4. -
Open a terminal and paste the following command:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - Press enter and follow the prompts to install homebrew
-
Open a terminal and paste the following command:
brew install git
Xcode
Xcode is a development environment for macOS that comes with git installed. It is available for free from the Mac App Store. It is a large download and will take a while to install so only use this method if you plan to use Xcode for development.
- Go to Xcode in the App Store
- Click the Get button
- Click the Install button
- Follow the prompts to install Xcode
- Open Xcode
- Restart your computer
- check that git is installed by opening a terminal, typing
git --version, and pressing enter