iTerm2 设置为登录 Shell,RVM 仍然报错
iTerm2 Setup as Login Shell, RVM Still Gives Error
几天来,我一直在尝试在我的 Macbook Pro 上安装 Ruby-2.6.1,并且我关注了很多帖子和博客帖子,试图获得设置正确,但我没有成功。尝试使用 RVM 设置默认 Ruby 时,我总是得到以下信息:
picklemac:~ jblanchard$ rvm use default ruby-2.6.1
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login
as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for an example.
我遵循了 link,但没有成功。我将 iTerm2 设置为登录 shell:
在 .bashrc 中我有以下内容:
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
在 .bash_profile 我有以下内容:
# rvm
# export PATH="/Users/jblanchard/.rvm/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
正如我所说,我已经阅读并尝试了很多方法来正确设置 iTerm2 和我的 Mac,包括 How to make zsh run as a login shell on Mac OS X (in iTerm)?。另外,因为我正在尝试从 Ruby 2.3 升级,所以我已经阅读了很多关于如何做到这一点的帖子 - 再次没有成功。
我做错了什么?
附加信息
我能够使用 rvm list
:
成功列出安装
picklemac:~ jblanchard$ rvm list
ruby-2.6.0 [ x86_64 ]
=* ruby-2.6.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
这很有趣,因为 RVM 指示 Ruby-2.6.1 是默认值,但是当我使用 ruby -v
时,return 是:
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
我能够成功更改为 Ruby-2.6.1。首先,我取消注释 .bash_profile:
中的 export
行
# rvm
export PATH="/Users/jblanchard/.rvm/bin:$PATH" #UNCOMMENTED
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
停止并启动 iTerm2 后,我发出使用 Ruby-2.6.1 的命令并收到警告,但随后:
picklemac:~ jblanchard$ rvm use default ruby-2.6.1
Warning! PATH is not properly set up, /Users/jblanchard/.rvm/gems/ruby-2.6.1/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.6.1
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Using /Users/jblanchard/.rvm/gems/ruby-2.6.1
已对 Ruby-2.6.1 进行更改。看来我确实需要 运行 rvm get stable --auto-dotfiles
来修复警告,我更愿意将其静音。现在,当 运行ning ruby -v
时 return 是:
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin17]
几天来,我一直在尝试在我的 Macbook Pro 上安装 Ruby-2.6.1,并且我关注了很多帖子和博客帖子,试图获得设置正确,但我没有成功。尝试使用 RVM 设置默认 Ruby 时,我总是得到以下信息:
picklemac:~ jblanchard$ rvm use default ruby-2.6.1
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use
/bin/bash --login
as the command. Please visit https://rvm.io/integration/gnome-terminal/ for an example.
我遵循了 link,但没有成功。我将 iTerm2 设置为登录 shell:
在 .bashrc 中我有以下内容:
# Add RVM to PATH for scripting. Make sure this is the last PATH variable change.
export PATH="$PATH:$HOME/.rvm/bin"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
在 .bash_profile 我有以下内容:
# rvm
# export PATH="/Users/jblanchard/.rvm/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
正如我所说,我已经阅读并尝试了很多方法来正确设置 iTerm2 和我的 Mac,包括 How to make zsh run as a login shell on Mac OS X (in iTerm)?。另外,因为我正在尝试从 Ruby 2.3 升级,所以我已经阅读了很多关于如何做到这一点的帖子 - 再次没有成功。
我做错了什么?
附加信息
我能够使用 rvm list
:
picklemac:~ jblanchard$ rvm list
ruby-2.6.0 [ x86_64 ]
=* ruby-2.6.1 [ x86_64 ]
# => - current
# =* - current && default
# * - default
这很有趣,因为 RVM 指示 Ruby-2.6.1 是默认值,但是当我使用 ruby -v
时,return 是:
ruby 2.3.7p456 (2018-03-28 revision 63024) [universal.x86_64-darwin17]
我能够成功更改为 Ruby-2.6.1。首先,我取消注释 .bash_profile:
中的export
行
# rvm
export PATH="/Users/jblanchard/.rvm/bin:$PATH" #UNCOMMENTED
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
停止并启动 iTerm2 后,我发出使用 Ruby-2.6.1 的命令并收到警告,但随后:
picklemac:~ jblanchard$ rvm use default ruby-2.6.1
Warning! PATH is not properly set up, /Users/jblanchard/.rvm/gems/ruby-2.6.1/bin is not at first place.
Usually this is caused by shell initialization files. Search for PATH=... entries.
You can also re-add RVM to your profile by running: rvm get stable --auto-dotfiles
To fix it temporarily in this shell session run: rvm use ruby-2.6.1
To ignore this error add rvm_silence_path_mismatch_check_flag=1 to your ~/.rvmrc file.
Using /Users/jblanchard/.rvm/gems/ruby-2.6.1
已对 Ruby-2.6.1 进行更改。看来我确实需要 运行 rvm get stable --auto-dotfiles
来修复警告,我更愿意将其静音。现在,当 运行ning ruby -v
时 return 是:
ruby 2.6.1p33 (2019-01-30 revision 66950) [x86_64-darwin17]