Library not loaded: libmysqlclient.18.dylib
Posted: August 12th, 2011 | Author: Alex Braunstein | Filed under: MySQL, Python | 6 Comments »Last week I upgraded to Lion from Snow Leopard. While I love the subtle touches of the new OS and even the natural (inverted) scrolling, it seriously screwed with my existing python packages and torched gcc until I installed X Code 4. I have a python script which uses the MySQLdb package. After a supposedly successful installation of MySQLdb, running my python script yielded the error:
Referenced from: /Users/alex/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so
Reason: image not found
For some reason the install pointed itself to the wrong place. Adding the following to your ~/.profile or ~/.bash_profile should fix the issue (assuming this is where you MySQL installation sits):
Open up a new terminal and you should be good to go.
Update! This also fixes some ruby 1.9 and rails 3 installation issues on OSX Lion. Thanks to Mauro Morales (@noiz777 for finding this!
Thanks a bunch – I was trying to install nginx and got this same error. Modifying the path like this as root solved the problem for me.
Also fixed an install of Rails 3.1 on OSX Snow Leopard. I’ve been tearing my hair out for hours, and this turned out to be the Final Solution – thank you for posting!
Thanks, this works a treat for me as well.
I had this problem as well and this got me most of the way there, but I additionally had to add a symlink to get Apache to stop throwing errors:
sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
credit: http://stackoverflow.com/a/9334020/602581
Thanks. Saved my day.
Thanks. In my case, I add it to my ~/.bash_login file.