Tobias Mühlbauer

Mercurial SCM (hg) fix for OS X 10.7 Lion

After upgrading to Mac OS X 10.7 (Lion) GM I experienced an issue with Mercurial. The command line tool hg seemed not to work any longer:
tobias:~ $ hg
abort: couldn't find mercurial libraries in [
/usr/platlib/Library/Python/2.6/site-packages
/usr/local/bin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
...]
(check your install and PYTHONPATH)

Indeed, updated paths to the Python frameworks in 10.7 are the cause. To fix the problem until a version of Mercurial for 10.7 is released:

  1. Re-install Mercurial for OS X 10.6 from http://mercurial.selenic.com/downloads/
  2. Open the file /usr/local/bin/hg
  3. Replace the line
    libdir = '../../platlib/Library/Python/2.6/site-packages/'

    with

    libdir = '/Library/Python/2.6/site-packages'

Mercurial’s hg should now work again as expected.

Update (July 17, 2011): There is a version of Mercurial for 10.7 now:
Mercurial 1.9 for MacOS X 10.7 (Thanks to Dimitris Dovinos)

  • Cevaris

    Thanks, this worked. 

  • Takide

    Actually, if you want this to work on 10.7.3 you need to put the “hg” file into /bin/ (for me)

  • Verakso

    After having pulled all my hair out for a couple of hours, this page was just what I needed to get the old Eclipse with Mercurial up and running again – thanks.