Reputation: 3567
I'm trying to install hg in my mac. My OS is 10.9(BD2). I use easy_install mercurial
or pip install -U Mercurial
, but all these prints error:
error: command 'gcc' failed with exit status 1
And I can use gcc command in my mac, what's wrong?
Upvotes: 1
Views: 1923
Reputation: 3629
This might be because you do not have python development headers installed. If you're on Linux, try installing the dev packages:
apt-get install python-dev
apt-get install libevent-dev
Otherwise, you can install Mercurial in a virtualenv:
sudo easy_install virtualenv
mkdir myenv && cd myenv && virtualenv . && . bin/activate
pip install Mercurial hg-git
(only include hg-git in pip install if you need it)
If the virtualenv command in the second line of the Mac instructions is not found in your PATH, then supplying a full path, like this, might work:
$ /usr/local/Cellar/python/2.7.1/Frameworks/Python.framework/Versions/2.7/bin/virtualenv .
Upvotes: 1
Reputation: 3388
For things like Mercurial, it's often easier and "better" to use the binary distribution. The release for OS X 10.8 can be found here -- I imagine it will also work on 10.9. The different releases for different versions of OS X are primarily related to differences in system python. Since 10.8 comes with Python 2.7, which is the newest -- and last -- version of the Python 2.x series, I think it's safe to assume that the Python version won't produce much difficulty here.
The binary distribution has two advantages:
you avoid compilation issues, such as ones not related to being able to find the correct headers (suggested in this answer
the binary installer will also do all the necessary work involving your path
The "disadvantage" is basically that you have effectively installed a full-fledged Unix utility and not just a python package in your site-packages
folder.
Another option, albeit much more complicated, is to download the sources and do a full build yourself. It's actually not as hard as it sounds, and you would be able to see exactly where the compile step fails.
Upvotes: 1