Installing MySQL Ruby Gem - Mac and Media Temple (dv)
Note to Regular Readers: I have landed a client that I’m doing front-end work for on Ruby on Rails, so I might start posting Rails stuff from time to time… BEWARE! =)
+
on

After getting rails installed on mac and Rails through Mongrel on Media Temple and running through the getting started with rails guide I was having issues installing MySQL ruby gem.
When I created a new rails app with rails blog -d mysql, it complained about not having mysql gem installed. Then that iis hwere I got an error installing the gem.
gem install mysql
Here is the error I was getting:
Building native extensions. This could take a while…
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension./usr/local/bin/ruby extconf.rb install mysql
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… yes
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… yes
checking for mysql_query() in -lmysqlclient… noGem files will remain installed in /usr/local/rubygems/gems/gems/mysql-2.7 for inspection.
Results logged to /usr/local/rubygems/gems/gems/mysql-2.7/gem_make.out
On Mac I fixed it by adding mysql config paramater.
sudo gem install mysql — —with-mysql-config=/usr/local/mysql/bin/mysql_config
On the Media Temple (dv) I fixed the error by using a different path to the mysql_config.
gem install mysql — —with-mysql-config=/usr/lib/mysql/mysql_config
2 comments
Thanks Marc! I’m sure this will help me sometime in the future.
THANK YOU!!!!! I spent 4 hours trying to fix this. Thanks for the fix