我现在已经使用RVM一年半了。
每次命令调用都有RVM PATH警告表面,但RVM仍然正常运行。我可能已使用此链接中的说明修复了该警告:StackOverflow - Getting “Warning! PATH is not properly set up” when doing rvm use 2.0.0 --default
这涉及将[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
放入我的bash
相关的一个shell配置文件中。
在调用链的其他可用文件中添加一个或太多,可能会导致这种奇怪的(主要是?)美学错误:SuperUser - Why am I having / how can I fix this error: “shell_session_update: command not found”
再次开始获取RVM PATH错误。我当时没有想到,但回头看问题,我想知道我是否刚刚将我的fish
shell从2.2.0更新到2.5.0,这可能会导致我的进一步实际 PATH错误(不是警告)......
执行rvm reset
没有帮助。
执行rvm get stable --auto-dotfiles
似乎有助于当前终端,但其他人,即使重启也是如此。决定重新安装。
跑rvm implode
。删除或注释掉了所有shell配置文件中的所有RVM行。
通过RVM - Integration - Fish Shell,StackOVerflow - Can't get RVM to switch rubies此处也介绍了RVM - Installing RVM - Quick (guided) Install,其中涉及首先执行StackOverflow - RVM doesn't set correct gem path部分内容。
curl -sSL https://get.rvm.io | bash -s stable --rails --with-default-gems="rails haml" --with-gems="hirb"
。rvm
fish
功能。rvm default
配置添加到config.fish
。我的ruby
可执行文件版本错误:
⋊> ~ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
这是系统ruby,而不是RVM-set版本:
⋊> ~ which ruby
/usr/bin/ruby
我没有捆绑命令:
⋊> ~ which bundle
⋊> ~ bundle
fish: Unknown command 'bundle'
⋊> ~ functions bundle
因此我不能使用Rails而不帮助我安装gem:
⋊> ~ rails
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
我的PATH
和GEM_PATH
变量似乎没有更新,如下所示。
我的问题是如何让这些变量更新?与此链接类似的内容:StackOVerflow - Need to Fix PATH in my bashrc File for RVM
⋊> ~ which rails
/usr/bin/rails
⋊> ~ functions rails
⋊> ~ ⨯
⋊> ~ head /usr/bin/rails
#!/usr/bin/ruby
# Stub rails command to load rails from Gems or print an error if not installed.
require 'rubygems'
version = ">= 0"
if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then
version = $1
ARGV.shift
end
⋊> ~ which rvm
⋊> ~ ⨯
⋊> ~ ls ~/.config/fish/functions/rvm.fish
/Users/username/.config/fish/functions/rvm.fish
⋊> ~ functions rvm|head
function rvm --description 'Ruby enVironment Manager'
# run RVM and capture the resulting environment
set --local env_file (mktemp -t rvm.fish.XXXXXXXXXX);
# echo "DEBUG: env_file: $env_file"
# This finds where RVM's root directory is and sources scripts/rvm from within it. Then loads RVM in a clean environment and dumps the environment variables it generates out for us to use.
bash -c 'PATH=$GEM_HOME/bin:$PATH;RVMA=$(which rvm);RVMB=$(whereis rvm | sed "s/rvm://");source $(if test $RVMA;then echo $RVMA | sed "s/\/bin\//\/scripts\//";elif test $RVMB; then echo $RVMB | sed "s/rvm/rvm\/scripts\/rvm/"; else echo ~/.rvm/scripts/rvm; fi); rvm "$@"; status=$?; env > "$0"; exit $status' $env_file $argv
# apply rvm_* and *PATH variables from the captured environment
and eval (grep -E '^rvm|^GEM_PATH|^GEM_HOME' $env_file | grep -v '_clr=' | sed '/^[^=]*PATH/s/:/" "/g; s/^/set -xg /; s/=/ "/; s/$/" ;/; s/(//; s/)//')
# needed under fish >= 2.2.0
⋊> ~ bash -c 'which rvm'
⋊> ~ bash -c 'whereis rvm'
⋊> ~ bash -c 'echo ~/.rvm/scripts/rvm;'
/Users/username/.rvm/scripts/rvm
⋊> ~ head /Users/username/.rvm/scripts/rvm
#!/usr/bin/env bash
# rvm : Ruby enVironment Manager
# https://rvm.io
# https://github.com/rvm/rvm
# partial duplication marker dkjnkjvnckbjncvbkjnvkj
# prevent from loading in sh shells
if
builtin test -n "${BASH_VERSION:-}" -o -n "${ZSH_VERSION:-}" -o -n "${KSH_VERSION:-}"
⋊> ~ rvm use
Using /Users/username/.rvm/gems/ruby-2.1.5 with gemset ux-rails3.2
⋊> ~ rvm list
rvm rubies
=* ruby-2.1.5 [ x86_64 ]
# => - current
# =* - current && default
# * - default
⋊> ~ ls /Users/username/.rvm/rubies/
default@ ruby-2.1.5/
⋊> ~ ls /Users/username/.rvm/rubies/ruby-2.1.5/
bin/ config include/ lib/ share/
⋊> ~ rvm env
export PATH="/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2/bin:/Users/username/.rvm/gems/ruby-2.1.5@global/bin:/Users/username/.rvm/rubies/ruby-2.1.5/bin:$PATH"
export GEM_HOME='/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2'
export GEM_PATH='/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2:/Users/username/.rvm/gems/ruby-2.1.5@global'
export MY_RUBY_HOME='/Users/username/.rvm/rubies/ruby-2.1.5'
export IRBRC='/Users/username/.rvm/rubies/ruby-2.1.5/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
export RUBY_VERSION='ruby-2.1.5'
⋊> ~ rvm env --path
/Users/username/.rvm/environments/ruby-2.1.5@ux-rails3.2
⋊> ~ cat /Users/username/.rvm/environments/ruby-2.1.5@ux-rails3.2
export PATH="/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2/bin:/Users/username/.rvm/gems/ruby-2.1.5@global/bin:/Users/username/.rvm/rubies/ruby-2.1.5/bin:$PATH"
export GEM_HOME='/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2'
export GEM_PATH='/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2:/Users/username/.rvm/gems/ruby-2.1.5@global'
export MY_RUBY_HOME='/Users/username/.rvm/rubies/ruby-2.1.5'
export IRBRC='/Users/username/.rvm/rubies/ruby-2.1.5/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
export RUBY_VERSION='ruby-2.1.5'
⋊> ~ rvm 2.1.5 do rvm env --path
/Users/username/.rvm/environments/ruby-2.1.5
⋊> ~ cat /Users/username/.rvm/environments/ruby-2.1.5
export PATH="/Users/username/.rvm/gems/ruby-2.1.5/bin:/Users/username/.rvm/gems/ruby-2.1.5@global/bin:/Users/username/.rvm/rubies/ruby-2.1.5/bin:$PATH"
export GEM_HOME='/Users/username/.rvm/gems/ruby-2.1.5'
export GEM_PATH='/Users/username/.rvm/gems/ruby-2.1.5:/Users/username/.rvm/gems/ruby-2.1.5@global'
export MY_RUBY_HOME='/Users/username/.rvm/rubies/ruby-2.1.5'
export IRBRC='/Users/username/.rvm/rubies/ruby-2.1.5/.irbrc'
unset MAGLEV_HOME
unset RBXOPT
export RUBY_VERSION='ruby-2.1.5'
⋊> ~ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.14.1
- RUBY VERSION: 2.0.0 (2015-12-16 patchlevel 648) [universal.x86_64-darwin16]
- INSTALLATION DIRECTORY: /Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
- EXECUTABLE DIRECTORY: /Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2/bin
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-16
- GEM PATHS:
- /Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2
- /Users/username/.rvm/gems/ruby-2.1.5@global
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
⋊> ~ gem list
bigdecimal (1.2.0)
bundler (1.7.6)
bundler-unload (1.0.2)
executable-hooks (1.3.2)
gem-wrappers (1.2.7)
hirb (0.7.3)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
test-unit (2.0.0.0)
⋊> ~ rvm gemset list
gemsets for ruby-2.1.5 (found in /Users/username/.rvm/gems/ruby-2.1.5)
(default)
global
=> ux-rails3.2
⋊> ~ rvm gemset dir
/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2
⋊> ~ ls /Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2/
bin
cache
environment
wrappers
⋊> ~ ls /Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2/bin/
⋊> ~
⋊> ~ ls /Users/username/.rvm/gems/ruby-2.1.5@global/bin/
bundle
bundler
executable-hooks-uninstaller
ruby_executable_hooks
⋊> ~ ls /Users/username/.rvm/gems/ruby-2.1.5/bin/
haml
ruby_executable_hooks
tilt
⋊> ~ echo $PATH
/usr/local/mysql/bin /usr/local/opt/coreutils/libexec/gnubin /usr/local/opt/findutils/bin /Users/username/bin /usr/local/mysql/bin /usr/local/opt/coreutils/libexec/gnubin /usr/local/opt/findutils/bin /Users/username/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /usr/local/munki /opt/puppetlabs/bin /Applications/Wireshark.app/Contents/MacOS
⋊> ~ echo $GEM_PATH
/Users/username/.rvm/gems/ruby-2.1.5@ux-rails3.2:/Users/username/.rvm/gems/ruby-2.1.5@global
⋊> ~ cat .ruby-gemset .ruby-version
ux-rails3.2
ruby-2.1.5
⋊> ~ grep "rvm" .config/fish/config.fish .bashrc .bash_profile .profile .zshrc .mkshrc .zlogin /etc/profile /etc/bashrc
.config/fish/config.fish:# Source: http://stackoverflow.com/questions/18276701/getting-warning-path-is-not-properly-set-up-when-doing-rvm-use-2-0-0-defaul
.config/fish/config.fish:rvm default;
.bashrc:# From running the command 'rvm get head ...'. Needs to be at the bottom, so no other PATH entries can change the order.
.bashrc:# Source: http://stackoverflow.com/questions/18276701/getting-warning-path-is-not-properly-set-up-when-doing-rvm-use-2-0-0-defaul
.bashrc:# export PATH="$PATH:$HOME/.rvm/bin"
.bash_profile:# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
.profile:# export PATH="$PATH:$HOME/.rvm/bin"
.profile:# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
grep: .zshrc: No such file or directory
grep: .mkshrc: No such file or directory
grep: .zlogin: No such file or directory
⋊> ~ ls .gemrc
ls: cannot access '.gemrc': No such file or directory
⋊> ~ rvm -v; ruby -v; rails -v; echo "gem version "(gem -v); rake -V; bundle -v;
rvm 1.29.1 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install rails
You can then rerun your "rails" command.
gem version 2.0.14.1
rake, version 0.9.6
fish: Unknown command 'bundle'
Mac 10.12.3
iTerm2 3.0.15
fish,版本2.5.0
bash
更相关,但可能仍然适用,因为fish
rvm
函数使用内部的bash:StackOverflow - How to set up path for gems with the Fish shell? 答案 0 :(得分:1)
到目前为止,通过以下方式进行更改,我几乎没有工作:
grep -E '^rvm|^GEM_PATH|^GEM_HOME'
为:
grep -E '^rvm|^[^=]*PATH|^GEM_HOME'
不确定会导致哪些副作用,但是从rvm.fish
代码看起来似乎缺失了。
旧版本中包含^[^=]*PATH\
字词,就像我系统的早期版本一样,也可以在此处随机找到:GitHub Gist - ToniRib/rvm.fish
这是为了转义管道(|)字符,但我不明白为什么在单引号内需要它。我的修复工作专门没有反斜杠,只有普通的管道字符。
我已经尝试过没有其他代码的补丁,例如:
and set -xg GEM_PATH (echo $GEM_PATH | sed 's/ /:/g')
and set -xg PATH (echo $GEM_PATH | sed 's/:/ /g') $MY_RUBY_HOME/bin $PATH
我正在继续为其添加行,但仍然会看到各种错误。首先,我需要"红宝石" ruby
的正确版本的目录,然后使用fish
的空格修改了两个宝石路径,但我仍遇到问题,因此请bash
PATH
环境变量批发并让rvm
脚本做自己的工作是我迄今为止最好的。