Nov21

Installing Rails with MySQL on a Mac

I recently ran into a problem with Ruby on Rails on my Mac when trying to execute the following command in a new Rails project.

rake db:migrate

The error I received was as follows.

dyld: NSLinkModule() error
dyld: Library not loaded: /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle
Reason: image not found
Trace/BPT trap

A quick Google search turned up a blog post by Peter Morris that had just the answer I needed. The relevant portion for this problem is excerpted below.

This is because the latest version of MySql has changed a path from lib/mysql to just lib/. To fix this problem you need to type the following (it’s all one line):

sudo install_name_tool -change /usr/local/mysql/lib/mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle

Thanks, Peter!


No Responses to “Installing Rails with MySQL on a Mac”

You can leave a response, or trackback from your own site.

 

Leave a Reply

You must be logged in to post a comment.

 

Recent Posts

Popular Categories

Grails Mac Rails Bible Code Coffee Candor

About

I’m a software engineer by day and even busier by night.  This blog contains my thoughts on subjects from the Bible to lines of code.  I write (and drink) Java, I’m learning Ruby and Rails and I read the King James Bible.  I’m hoping to move the country and buy a farm and stay home with my family to bring them up in the nurture and admonition of the Lord.