简体   繁体   English

使用ruby 1.8.7 Mac OSX 10.6安装mysql2 gem

[英]Installing mysql2 gem with ruby 1.8.7 Mac OSX 10.6

I am currently trying to install the mysql2 gem, under Ruby 1.8.7 and Mac 10.6.6 and mysql 64 bits, so I can use Rails 3 and mysql together. 我当前正在尝试在Ruby 1.8.7和Mac 10.6.6和mysql 64位下安装mysql2 gem,因此可以同时使用Rails 3和mysql。

When I do the command: 当我执行命令时:

sudo gem install mysql2

I get: 我得到:

Building native extensions.  This could take a while...
Successfully installed mysql2-0.2.6
1 gem installed
Installing ri documentation for mysql2-0.2.6...
Enclosing class/module 'mMysql2' for class Client not known
Enclosing class/module 'mMysql2' for class Result not known
Installing RDoc documentation for mysql2-0.2.6...
Enclosing class/module 'mMysql2' for class Client not known
Enclosing class/module 'mMysql2' for class Result not known

I did a lot of things recommended for this problem here on SO, but nothing seemed to help. 我在SO上针对此问题做了很多建议,但似乎无济于事。

Has anyone got a idea about what to do next? 有人知道下一步该怎么做吗?

Edit: When I try do to rake db:migrate, it says: http://pastebin.com/tuPwQmqL . 编辑:当我尝试耙db:migrate时,它说: http : //pastebin.com/tuPwQmqL I can't do rails server either. 我也不能做Rails服务器。

Edit 2: Managed to do it, thanks! 编辑2:设法做到了,谢谢!

This is just a warning that the documentation for a module is empty. 这仅是模块文档为空的警告。 It shouldn't cause any problems. 它不会引起任何问题。

If you are able to your commands like "rake db:migrate" etc. Everything is fine :) 如果您能够执行“ rake db:migrate”等命令,那么一切都很好:)

Update: http://freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails /. 更新: http//freddyandersen.wordpress.com/2010/10/03/mysql-5-5-snow-leopard-and-rails/ This link should solve your problem. 此链接应该可以解决您的问题。 I faced the same problem on my other mac :) 我在其他Mac上也遇到了同样的问题:)

If you're using Rails 3, you should definitely be using Bundler and not doing sudo gem install anything. 如果您使用的是Rails 3,则一定要使用Bundler而不是sudo gem安装任何东西。 Add mysql2 to your Gemfile and just run bundle . 将mysql2添加到您的Gemfile中,然后运行bundle That should install without any errors and let you run rake commands. 该安装应该没有任何错误,并允许您运行rake命令。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM