Why am I getting the error: command 'llvm-gcc-4.2' failed with exit status 1

BryanWheelock picture BryanWheelock · Feb 22, 2012 · Viewed 26.5k times · Source

I am setting up os X 10.7.

I am using the default install of Python:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/

I use a Python based package manager called easy_install. Easy_install seems to not be able to find the compiler.

EDIT: When I tried to install MySQL-python I got this error:

$ sudo easy_install MySQL-python 
Password:
Searching for MySQL-python
Reading http://pypi.python.org/simple/MySQL-python/
Reading http://sourceforge.net/projects/mysql-python/
Reading http://sourceforge.net/projects/mysql-python
Best match: MySQL-python 1.2.3
Downloading http://download.sourceforge.net/sourceforge/mysql-python/MySQL-python-1.2.3.tar.gz
Processing MySQL-python-1.2.3.tar.gz
Running MySQL-python-1.2.3/setup.py -q bdist_egg --dist-dir /tmp/easy_install-P9H9WX/MySQL-python-1.2.3/egg-dist-tmp-rRTfZL
warning: no files found matching 'MANIFEST'
warning: no files found matching 'ChangeLog'
warning: no files found matching 'GPL'
unable to execute llvm-gcc-4.2: No such file or directory
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1

error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1

Xcode 4.1 used GCC, but with Xcode 4.2 that seems to have changed.

What compiler does Apple want us to use? How do I setup the configuration so I can compile OSS?

Answer

Mark Chackerian picture Mark Chackerian · Apr 4, 2012

I had the exact same problem when I upgraded from OSX 10.6 to 10.7. If you upgrade to 10.7 from 10.6, your version of Python may go from 2.6 to 2.7 and a result you may need to re-install most of your python packages.

Here's what worked for me:

  1. Install the latest version of XCode from the App Store
  2. Inside XCode, go to Preferences -> Downloads -> Components
  3. download the Command Line Tools

That's all you need to do. Try to install again in a new shell. The command line tool installation will put llvm-gcc-4.2 into /usr/bin which should be in your default path. The installation also takes care of library paths and stuff that you don't really want to know about unless something breaks.

10.9 edit

If you're running 10.9 or higher, I think you might be able to run this from the command line instead to install the command line tools:

xcode-select --install

I haven't verified that this is an actual fix to the problem.