且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

可以“安装宝石”被配置为在默认情况下在/ usr / bin /之外安装可执行文件?

更新时间:2023-01-14 21:52:42

请参阅 http:// www。 rubygems.org/read/chapter/11 并指定一个定义gemhome变量的〜/ .gemrc



例如:

  gemhome:/ usr / local / ruby​​gems 

您也可以将此文件放置在 / etc / gemrc中



您也可以设置 GEM_HOME env-variable

  $ export GEM_HOME = / tmp / gemtest 
$ gem install bundler
$ ls / tmp / gemtest / bin /
bundle


By default, when you sudo gem install thegemname it will install executables into /usr/bin/

Is there a way to change this? For example, to install them into /usr/local/rubygems/bin (or any other path)?

The path doesn't seem to be hard-coded into the gemspec file, so I don't see why this shouldn't be possible (although I have very little experience with Ruby/Gems)

See http://www.rubygems.org/read/chapter/11 and specify a ~/.gemrc which defines a gemhome variable.

For example:

gemhome: /usr/local/rubygems

You can also place this file in /etc/gemrc

Alternatively you can set the GEM_HOME env-variable:

$ export GEM_HOME=/tmp/gemtest
$ gem install bundler
$ ls /tmp/gemtest/bin/
bundle