Two ways to install Mercurial on Mac OSX Leopard

by gldnspud on January 31, 2008

I'm back on the OSX platform, using Leopard, even. After a four-month absence, all of the keyboard shortcuts are coming back to me quickly. (The most disruptive I think is the distinction between switching between apps and switching between different windows of the same app.) I'm still within the first 24 hours of installing software and making it "home".

One of the pieces of software I needed to install was Mercurial. I quickly found out that, like many tools ported from elsewhere in the Linux/BSD/etc world, there is more than one way to install the same thing. :)

Install using a native installer

This is the easiest method, because, if you're using Leopard, it's one download and one package installation away.

http://mercurial.berkwood.com/ is a great resource. Scroll down past the Windows section and you will find instructions for Tiger users who haven't yet installed Python 2.5.1. Following that, you will find prepackaged installers for Mercurial, including recent fixes beyond the 0.9.5 release version.

Download the ZIP file you want, open it to extract it (Safari does that part for you), then open the installer (you can right-click in Safari then choose Open). Follow all the usual steps.

Now you can open Terminal and run hg --version to make sure it's installed. Running which hg should return /usr/local/bin/hg for this type of installation.

Install using MacPorts

This method is a little more involved, because you need to first download and install MacPorts, which involves making sure you have the latest Xcode installed. You may have already installed such things if you are a "power user".

Once you have MacPorts set up, run sudo port -v install mercurial from within a Terminal window. It takes several minutes for it to download and install all of the prerequisites that it needs.

When it's done, as noted above, you can use hg --version to make sure it's installed. Running which hg should return /opt/local/bin/hg.

{ 2 comments… read them below or add one }

ches April 1, 2008 at 4:29 pm

A third way, now that 1.0 is out and fixes easy_install:

$ easy_install mercurial

Leopard conveniently has Python 2.5 and setuptools ready to go, so it’s easy to grab the latest release this way, without waiting for the binary distributions to catch up. I like this approach because it’s easy to upgrade frequently.

This does require manually setting up hgk, though, as you have discussed in another article.

yinglcs February 7, 2009 at 9:15 pm

Hi,

Can you please tell me how to install forest extension for mercurial on Mac?
I went to http://www.selenic.com/mercurial/wiki/index.cgi/ForestExtension but I don’t see where I can download the extension?

I don’t see anything here: http://hg.akoha.org/hgforest/

Thank you.

Leave a Comment

Previous post:

Next post: