This is my config:
rails 2.3.5
ruby 1.8.7 gem 1.8.11 mamp 2.0.3 (which uses Mysql 5.5)When creating a new rails project with mysql as the database, I get an error:
An error occured while installing mysql2 (0.3.7), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.7'` suc开发者_开发知识库ceeds before bundling.
I believe this is because gems can't find the MAMP mysql files. So a tutorial says I should download the MAMP libraries and compile it without server so I can then point the gem to those files. The problem is that all tutorials use ./configure which no longer works for Mysql 5.5, instead you have to use cmake. This tutorial: http://blog.mirotin.net/35/mamp-1-9-5-mysql-5-5-9-and-ruby-mysql2 mentions a way to do it using cmake, but this command fails for me:
sudo port install cmake
can't find command port. So I tried with homebrew sudo brew install cmake which gives:
Cowardly refusing to `sudo brew install'
So... What are my options? Rails and rubygems all seem to work, it's just pointing it to the MAMP mysql libraries that I'm having a problem with, I'm very new to rails (started yesterday). Any help would be appreciated.
Thanks.
In the end, installing cmake without sudo (who would have thought?) did work:
brew install cmake
Then I followed the instructions on this page: http://blog.mirotin.net/35/mamp-1-9-5-mysql-5-5-9-and-ruby-mysql2
and everything seems to be working. Also for those of us new to ruby on rails, you might need to edit config/database.yml and add the socket directive, pointing to the MAMP socket:
socket: /Applications/MAMP/tmp/mysql/mysql.sock
Hope this helps someone else.
PS
I'll be sure to mark this as answered and give me lots of credit for it, thereby showing appreciation for myself so I can answer my future questions!
精彩评论