如何使用rbenv在没有sudo的情况下全局安装gem? [英] How to install a gem globally without sudo using rbenv?
问题描述
我正在使用 rbenv
,并试图安装 sass
,但没有成功。
因此,我通过自制软件安装 rbenv
,然后是Ruby 2.2( rbenv install 2.2
),最后是 gem install sass
,但我无法使<$我的 $ PATH
。
可用的c $ c> sass 我使用我的系统(Yosemite)默认的Ruby 2安装了sa sudo gem install sass 。这将所有内容放在 理想情况下,使用 任何可能出错的帮助都将非常值得赞赏。 基本上,问题我没有将 更好的是,将它添加到 然后,请确保: shims和autocompletion。 对于那些使用鱼的人来说,你可以像这样完成: p> 现在,如果您不喜欢修改 作为最终警告,请确保安装 如果您使用 homebrew 这很容易: I am using So, I installed Short on time, I Ideally, using Any help as to what could have gone wrong would be very much appreciated. Basically, the problem was I did not add Better yet, add this to your After that, make sure to: In order to enable shims and autocompletion. For those using fish, you can accomplish the same like this: Now, if you don't like modifying
As a final warning, make sure to install If you are using homebrew it's easy as pie:
这篇关于如何使用rbenv在没有sudo的情况下全局安装gem?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! /Library/Ruby/Gems/2.0.0中。
$ b rbenv
,并且事情能够工作,但不是最理想的方式。我应该能够安装任何Ruby版本,并且在该版本的目录中安装gems,然后将它们symlink到 / usrl / local / bin
。
rbenv / bin / rbenv
添加到 $ PATH
。
export PATH =$ HOME / .rbenv / bin:$ PATH
.bashrc
或 .bash_profile
中,使用<$ c开始每个会话
$ p
$ b
<$ p $ p> eval$(rbenv init - )
fishshell
if status --is-interactive
。 (rbenv init - | psub)
end
$ PATH
,并拥有 / usr / local / bin
的所有权,一个更好的解决方案是使用〜/ .rbenv / bin / rbenv
。
ln -s〜/。 rbenv / bin / rbenv / usr / local / bin
ruby-build
ruby-建立
(a rbenv
插件将安装
命令添加到 rbenv
并且能够轻松安装Ruby版本。)
brew install ruby-build
rbenv
and I am trying to install sass
without success.rbenv
via Homebrew, then Ruby 2.2 (rbenv install 2.2
) and finally gem install sass
, but I was unable to make sass
available on my $PATH
.sudo gem install sass
using my system's (Yosemite) default Ruby 2. This put everything in /Library/Ruby/Gems/2.0.0
and things do work, but not in the most desireable way.rbenv
I should be able to install any Ruby version and have gems installed inside that version's directory and later symlinked to /usrl/local/bin
.rbenv/bin/rbenv
to $PATH
.export PATH="$HOME/.rbenv/bin:$PATH"
.bashrc
or .bash_profile
to start every session with rbenv
.eval "$(rbenv init -)"
fishshell
if status --is-interactive
. (rbenv init - | psub)
end
$PATH
directly and have ownership over /usr/local/bin
, a more nifty solution is to symlink with ~/.rbenv/bin/rbenv
. ln -s ~/.rbenv/bin/rbenv /usr/local/bin
ruby-build
ruby-build
(a rbenv
plugin to add the install
command to rbenv
and be able to easily install Ruby versions.)brew install ruby-build