RoR: Bundler:如何在gemfile中设置gem ?

时间:2021-10-06 12:34:07

standard is this:

标准是这样的:

gem "mysql", "2.7"

but.. when I install this gem in the terminal, I have to run this command:

但. .当我在终端安装这个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

1 个解决方案

#1


4  

It's only part of the answer but it should at least get you part of the way:

这只是答案的一部分,但至少可以让你了解其中的一部分:

bundle config build.mysql --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config --no-rdoc --no-ri

This will create .bundle/config in your home directory, with the build options saved for the next time you're bundl'ing install.

这将在您的主目录中创建.bundle/config,并将构建选项保存到下次bundl安装时使用。

For the second part (setting the environment variable), you could either export the variable somewhere where it would get set up permanently (eg. in your .bashrc) or always run the command this way.

对于第二部分(设置环境变量),您可以将变量导出到它将永久设置的地方(如:。或者总是以这种方式运行命令。

#1


4  

It's only part of the answer but it should at least get you part of the way:

这只是答案的一部分,但至少可以让你了解其中的一部分:

bundle config build.mysql --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config --no-rdoc --no-ri

This will create .bundle/config in your home directory, with the build options saved for the next time you're bundl'ing install.

这将在您的主目录中创建.bundle/config,并将构建选项保存到下次bundl安装时使用。

For the second part (setting the environment variable), you could either export the variable somewhere where it would get set up permanently (eg. in your .bashrc) or always run the command this way.

对于第二部分(设置环境变量),您可以将变量导出到它将永久设置的地方(如:。或者总是以这种方式运行命令。