如何设置 Ruby GEM_HOME 和 GEM_PATH

Amj*_*jad 11 linux scripting ubuntu environment-variables linux-mint

我是 Linux 的新手用户,使用 Linux mint 17.1

我在过去 3 天内为该问题重新安装了 Linux Mint 20 次,但无法修复它

我正在尝试使用 rvm 在 rails 上安装 ruby .

通过在过去 3 天内重新安装它超过 20 次,我也在网上搜索过。有人告诉我将环境变量放入/etc/environment我在该会话中回显的路径中并将其粘贴到/etc/environment文件中。

即使现在我也没有得到我安装的 gems

当我输入时rvm -v出现以下错误

Warning: PATH set to RVM ruby but GEM_HOME and/or GEM_PATH not set, see:
    https://github.com/wayneeseguin/rvm/issues/3212

Warning! PATH is not properly set up, $GEM_HOME is not set,
         usually this is caused by shell initialization files - check them for 'PATH=...' entries,
         it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
         to fix temporarily in this shell session run: 'rvm use ruby-2.2.2'.
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
Run Code Online (Sandbox Code Playgroud)

在使用终端时,我是一个非常新手的人,我可以运行一些基本命令来使用 ruby​​。

我想知道

  1. 如何设置路径
  2. 如何设置 GEM_HOME
  3. 如何设置 GEM_PATH

下面是我的完整路径

echo $PATH
/home/sharif/.rvm/gems/ruby-2.2.2/bin:/home/sharif/.rvm/gems/ruby-2.2.2@global/bin:/home/sharif/.rvm/rubies/ruby-2.2.2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/sharif/.rvm/bin
Run Code Online (Sandbox Code Playgroud)

Jon*_*han 22

听起来你想要export设置环境变量的命令:

export PATH=$PATH':/path/to/add'
export GEM_HOME=$HOME/.gem
export GEM_PATH=$HOME/.gem
Run Code Online (Sandbox Code Playgroud)

不过,这只会对当前会话生效。为了使它们更持久,请将这些行添加到您的~/.bashrc.