简体   繁体   English

如何使用捆绑程序安装mysql gem? (OS X Lion)

[英]How do I install mysql gem using bundler? (OS X Lion)

So, I currently have to do this to install the mysql gem: 因此,我目前必须执行此操作以安装mysql gem:

export ARCHFLAGS="-arch x86_64" ; sudo gem install --no-rdoc --no-ri mysql -v 2.7 -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config

now, in bundler, I'd do something like 现在,在捆扎机中,我会做类似的事情

gem "mysql", "2.7"

which gives the error: 这给出了错误:

uninitialized constant MysqlCompat::MysqlRes

because the mysql gem isn't built right. 因为mysql gem的构建不正确。

EDIT: oh, I'm also using RVM. 编辑:哦,我也在使用RVM。
What I i'm going to try, is re-install the mysql gem normally (the long command), and try copying it into the rvm directory. 我要尝试的是正常地重新安装mysql gem(长命令),然后尝试将其复制到rvm目录中。

I'm on OS X Lion 我在OS X Lion上

use 采用

gem install mysql2 -v 0.2.6 gem安装mysql2 -v 0.2.6

instead of 代替

gem "mysql", "2.7" gem“ mysql”,“ 2.7”

I had the same issue. 我遇到过同样的问题。

I fixed the problem (kinda) by not using a gemset. 我通过不使用gemset解决了该问题(类型)。
So, all my gems for this project are in the main ruby 1.8.7 environment inside ~/.rvm/. 因此,我为该项目准备的所有宝石都位于〜/ .rvm /中的主要ruby 1.8.7环境中。

=\\ = \\

So.. that's one way to do it. 所以..那是一种方法。

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

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