4

I recently upgraded to Mac OS X 10.7 from 10.6.

I decided to use Python 2.7.

But when I'm trying to install the MySQLdb module to run Django, it fails:

$ sudo pip install MySQL-python
Downloading/unpacking MySQL-python
  […]
  Running setup.py install for MySQL-python
    building '_mysql' extension
    llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64
    unable to execute llvm-gcc-4.2: No such file or directory
    error: command 'llvm-gcc-4.2' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='~/Sites/gugsm/build/MySQL-python/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-AwMuqj-record/install-record.txt:
    running install

running build

[…]

building '_mysql' extension

creating build/temp.macosx-10.7-intel-2.7

llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -pipe -Dversion_info=(1,2,3,'final',0) -D__version__=1.2.3 -I/usr/local/mysql/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c _mysql.c -o build/temp.macosx-10.7-intel-2.7/_mysql.o -Os -g -fno-common -fno-strict-aliasing -arch x86_64

unable to execute llvm-gcc-4.2: No such file or directory

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

----------------------------------------

The reason is that I no longer have llvm-gcc nor gcc binaries.

I tried to upgrade XCode from 3.something to 4.3.2, but it din't help. It comes as a simple app and it doesn't populate /usr/bin with llvm-gcc.

What am I doing wrong?

alexpirine
  • 3,023
  • 1
  • 26
  • 41

2 Answers2

14

In Xcode 4.3's Preferences menu, select Downloads and then install Command Line Tools.

Ned Deily
  • 83,389
  • 16
  • 128
  • 151
  • Thanks for the hint. As soon it's downloaded and installed I'll tell you if that solves my problem. – alexpirine May 03 '12 at 15:09
  • @Ned: thanks! I was pulling my hair on this Apple nonsense and you solved my problem :-) – marco.m Jun 26 '12 at 08:49
  • I had the same problem when trying to update some Ruby gems. Apparently the Makefile of a library expected to find `usr/bin/gcc-4.2`, which was no longer there, so I had to symlink `usr/bin/llvm-gcc-4.2` to just ..`gcc-4.2` – fanaugen Sep 03 '12 at 14:05
4

making a symlink worked for me:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Shaun
  • 41
  • 1