2

I have two versions of mercurial installed on my Mac OS 10.6.6 and I want to use one of them by default.

I installed mercurial with a binary from here. I have been running mercurial from the terminal with the hg command as it is installed in

/Library/Python/2.6/site-packages

even though I mostly use Python 2.7.

As a side note, the other Python 2.6 site-packages directory located at

/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python2.6/si­te-packages

did not have mercurial installed.

Using mercurial with 2.6 while mostly using 2.7 for everything else finally caught up to me. (See this thread.)

I have since installed mercurial (with pip, not the binary from the website) for Python 2.7 in

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

but I'm not sure how to indicate which mercurial the hg command should use by default. It is using the original 2.6 one right now and I want to use the newer, 2.7 one from now on.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
arturomp
  • 28,790
  • 10
  • 43
  • 72
  • Doesn't sound like you're using virtualenv. You could just symlink the hg command (is it /usr/bin/hg) to a small script to use python2.7 instead (#!/usr/bin/env python2.7, etc. – Ryan Mar 04 '11 at 20:53
  • Thanks! Indeed I didn't want to get involved with virtualenv if it wasn't necessary. I arrived at the same conclusion - symlinking saved me here. – arturomp Mar 04 '11 at 21:11

2 Answers2

1

Never mind - in the last few minutes I looked all over for the hg command.

It found them in

/usr/local/bin/hg

which was put there by the binary downloaded from the website some time ago, and

/Library/Frameworks/Python.framework/Versions/2.7/bin/hg

which was created today when I installed with pip.

So I just renamed /usr/local/bin/hg to /usr/local/bin/hg-2.6 and symlinked /usr/local/bin/hg to /Library/Frameworks/Python.framework/Versions/2.7/bin/hg.

arturomp
  • 28,790
  • 10
  • 43
  • 72
1

Virtualenv would be a best solution for you.

http://stevelosh.com/blog/2009/06/how-to-contribute-to-mercurial/

See that link. Leave out the contributing part. Just create a virtual env and instead of doing the ln -s commands, do a pip install mercurial there. And the rest should work fine.

tamizhgeek
  • 1,371
  • 3
  • 13
  • 25