Installing Mercurial on Snow Leopard
These are instructions for compiling and installing Mercurial, a fast and lightweight source control management system, on Mac OS X 10.6 (Snow Leopard).
If you would like to learn more about Mercurial, I’ve created a PeepCode screencast about it that you can check out.
Before following these instructions, you will need:
- Mac OS X 10.6 Snow Leopard
- The latest Xcode Tools (from the Snow Leopard DVD or downloaded from Apple — the 10.5 version won’t work)
- Confidence running UNIX commands using the Terminal
If you want to learn more about UNIX and the command line, check out my PeepCode screencast on this topic.
Step 1: Set the PATH
Launch Terminal.app from the
We need to set your shell’s PATH variable first. The PATH variable determines where your system searches for command-line programs. Using the editor of your choice, create and edit a file in your home directory named
.profile (note the “.” preceding the filename).
To the end of this file, add the following lines:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" export PYTHONPATH=/usr/local/lib/python2.6/site-packages
Close and save the file and run this command to load the new setting into your current shell:
To verify that you’ve updated your path, enter the following command:
You should see
/usr/local/bin at the beginning of the line returned by the system.
Step 2: Download
We’re going to create a folder to contain the files we’re about to download and compile. If you want, you can delete this folder when you’re done, but keeping it around makes it easier to re-install (or uninstall) these apps later.
Make the new folder:
mkdir ~/src cd ~/src
Download Mercurial like this:
curl -O http://mercurial.selenic.com/release/mercurial-1.3.1.tar.gz
Step 3: Compile and Install
Build and install Mercurial like this:
tar xzvf mercurial-1.3.1.tar.gz cd mercurial-1.3.1 make all sudo make install cd ..
To verify that Mercurial is installed and in your path, just type:
You should see:
If you do, this means Mercurial is ready to go. Just type
hg to get started. If you saw something different, you haven’t set your path correctly. Go back and try again.
Congratulations, you now have a custom-built Mercurial. Now start coding.