[Fixed]-Can't install python mysql library on Mac Mavericks

40👍

The problem is due to changes introduced in Xcode 5.1 and due to the way the Apple-supplied system Python 2.7 is built. Try adding these environment variable values before running pip:

export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments

See clang error: unknown argument: '-mno-fused-madd' (python package installation failure) for more information.

UPDATE [2014-05-16]: As expected, Apple has fixed this problem with updated system Pythons (2.7, 2.6, and 2.5) in OS X 10.9.3 so the workaround is no longer necessary when using the latest Mavericks and Xcode 5.1+. However, as of now, the workaround is still required for OS X 10.8.x (Mountain Lion, currently 10.8.5) if you are using Xcode 5.1+ there.

0👍

Building on Ned’s answer:

Since I don’t want to use sudo to install packages (I am using virtual environments) or affect my golbal environment, I added the two variables to the single execution of pip install:

CFLAGS=-Qunused-arguments CPPFLAGS=-Qunused-arguments pip install -r requirements.txt

Leave a comment