Friday, September 19, 2014

Trouble installing PyCrypto on Mac OSX 10.9

This afternoon I was trying to install the PyCrypto Python library on my Mac running OSX 10.9.4 with the built in Python. To install the library I was using the command 'sudo pip install pycrypto' but it kept failing when trying to compile parts of the library with the C compiler. This is the error I was getting:

checking for gcc... gcc

checking whether the C compiler works... no

configure: error: in `/private/tmp/pip_build_root/pycrypto':

configure: error: C compiler cannot create executables

See `config.log' for more details

Grrr... I searched around and read a bunch of stackoverflow questions but it seemed like I had everything in place that I needed to compile this library. Xcode was installed, I have the Command Line Tools installed, I have a recent version of pip installed. Why won't the C compiler work??

Well the answer turned out to be something really dumb. I recently updated Xcode but I had not launched the Xcode application since it was updated. Turns out the command line C compiler won't compile anything until you accept the license agreement for the updated Xcode. I opened the Xcode gui and clicked Accept. After that I was able to install PyCrypto. I also found you can accept the agreement from the command line using the command 'sudo xcodebuild -license' but you have to page through all the text and type agree.


Please note all comments are moderated by me before they appear on the site. It may take a day or so for me to get to them. Thanks for your feedback.