1

I recently upgraded to Mac OS Mojave and now can't install MySQL-Python:

pip install MySQL-Python
...
clang -bundle -undefined dynamic_lookup build/temp.macosx-10.13-x86_64-2.7/_mysql.o -L/usr/local/opt/mysql-client/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.13-x86_64-2.7/_mysql.so
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'clang' failed with exit status 1

The stack trace says that the "ssl" library wasn't found. I'm not sure what that means though as I have the latest XCode and OpenSSL is installed. Any advice appreciated.

asked Nov 24, 2018 at 22:26

2 Answers 2

5

I had the same issue on MacOS 10.14, and I was able to solve it using these steps:

Change permissions for /usr/local to allow Homebrew to create links:

sudo chown -R $(whoami) $(brew --prefix)/*

Re-install openssl now that permissions have been fixed:

brew reinstall openssl

Run these two commands to allow compilers to find openssl:

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

Then, try again to install MySQL-Python:

pip install MySQL-Python
answered Dec 12, 2018 at 22:47
Sign up to request clarification or add additional context in comments.

Comments

1

Change permissions for /usr/local to allow Homebrew to create links:

sudo chown -R $(whoami) $(brew --prefix)/*

Re-install openssl now that permissions have been fixed:

brew reinstall openssl

Run these two commands to allow compilers to find openssl:

export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"

Then, try again to install MySQL-Python:

pip install MySQL-Python

It works for Mac 10.14.2 with python2.7 /Django 1.9.8 and mysql-server 8 with mysql-clinet;

answered Feb 6, 2019 at 7:29

1 Comment

As of 2019, this is the only valid solution which works on a mac. Other answers on SO which suggest link/unlink of mysql c connector simply dont work. Thanks!

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.