Installing MySQL-python causes command clang failed with exit status 1 on Mac OS 10.13.15
Installing MySQL-python causes command clang failed with exit status 1 on Mac OS 10.13.15
I just resolved this exact issue when running Ansibles mysql_user module. The answer here helped tip me off to a solution. I also needed MySQL-python
from pip
, which also broke in this process, so Ive added the extra steps.
Steps to resolve:
brew unlink mysql # only if installed, causes the next step to fail
brew install mysql-connector-c
- locate
mysql_config
file withwhich (mysql_config)
-
edit the
mysql_config
file, under# Create options
change this:libs=$libs -l
to this:
libs=$libs -lmysqlclient -lssl -lcrypto
if using vim,
:wq!
to save the read-only file -
Now the install should run successfully
pip install mysqlclient
-
Adding this separately, as its similar but not directly related to the initial question
pip install MySQL-python
-
Fix
mysql
brew formula, if it was unlinked in the first step.brew unlink mysql-connector-c
brew link mysql
I fixed it by passing the OpenSSL path:
env LDFLAGS=-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib pip install mysqlclient
You can see the full article of the solution done by MrWeeble
Installing MySQL-python causes command clang failed with exit status 1 on Mac OS 10.13.15
I solved this issue by setting xcode-select to use non-XCode command line tools, as shown in the below answer. I had a related clang
error which led me to this answer.
sudo xcode-select --switch /Library/Developer/CommandLineTools