How to get started with Git on Mac

Use MacPorts:

sudo port install git

A general introduction:

  • Git Immersion

Git Immersion is a guided tour that walks through the fundamentals of Git, inspired by the premise that to know a thing is to do it.


The git-osx-installer that you used should have installed git into /usr/local/git. See if you can cd into that directory. If you can, then check that your PATH was correctly set by running echo $PATH from the terminal and making sure that you see /usr/local/git/bin in the included PATH. If not, you need to add it to your PATH.

Did you run the included shell script setup git PATH for non-terminal programs.sh?

Update 1: How to run the included shell script

  1. Mount the git-osx-installer disk image by double-clicking git-1.7.3.5-x86_64-leopard.dmg, which should be located in your Downloads folder.
  2. Open Terminal from /Applications/Utilities/Terminal
  3. Type cd /Volumes/Git 1.7.3.5 x86_64 Leopard/
  4. Type ./setup git PATH for non-terminal programs.sh and hit Enter to run the shell script. Note: Once you type ./setup you can hit the Tab key and it will autocomplete for you.
  5. Open a new Terminal and type echo $PATH
  6. Confirm that you see /usr/local/git/bin in your PATH.

Update 2: Show Git Who's the Master

Open Terminal and issue the following commands:

echo "/usr/local/git/bin" > git
sudo mv git /etc/paths.d

When you run sudo it will ask for your OS X password.

After issuing those two commands, you should be able to open a new Terminal window and see /usr/local/git/bin when you run echo $PATH.

For this to work you have to have the following in /etc/profile, which it does by default:

if [ -x /usr/libexec/path_helper ]; then
    eval `/usr/libexec/path_helper -s`
fi

Tags:

Macos

Git