我使用的是Mac OS X,我有一些个人资料和bash_profile。以下是我的文件的内容:
cat ~/.profile
PATH=/usr/local/git/bin:$PATH
export PATH
和
cat ~/.bash_profile
export JAVA_HOME=$(/usr/libexec/java_home)
export M2_HOME=/Users/myName/Tools/apache-maven-3.2.5
export GIT_HOME=/usr/local/git
export PATH=$PATH:$M2_HOME/bin:$GIT_HOME/bin
### Added by the Heroku Toolbelt
export PATH="/usr/local/heroku/bin:$PATH"
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
MYSQL=/usr/local/mysql/bin
export PATH=$PATH:$MYSQL
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
### ADDED FOR SUBLIME SYMLINK
export PATH=/usr/bin/local/bin:$PATH
以下是$ PATH的内容:
echo $PATH
/usr/bin/local/bin:/Users/myname/.rbenv/shims:/Users/myname/.rbenv/shims:/usr/local/heroku/bin:/usr/local/git/bin:/usr/local/git/bin:/usr/local/git/bin:/Users/myname/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rspec-3.4.0/lib/rspec.rb:/usr/bin/local/bin:/Users/myname/.rbenv/shims:/Users/myname/.rbenv/shims:/usr/local/heroku/bin:/usr/local/git/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/ImageMagick/bin:/Users/myname/Tools/apache-maven-3.2.5/bin:/usr/local/git/bin:/usr/local/mysql/bin:/Users/myname/Tools/apache-maven-3.2.5/bin:/usr/local/git/bin:/usr/local/mysql/bin
我不明白为什么我有/Users/myname/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rspec-3.4.0/lib/rspec.rb in路径。我怎么能删除它?我无法在〜/ .profile和〜/ .bash_profile中看到它。
感谢您的帮助
答案 0 :(得分:1)
这是由rbenv设置的RSpec的binstub。
rbenv rehash
确保您的.rbenv/versions/...
文件夹是最新的rbenv shell 2.2.2
gem uninstall -a rspec
rbenv rehash
你应该只有这一行:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
你的$ PATH中也有大量的重复,你的bashrc文件可能被多次加载,或者你正在运行另一个你不知道的RC脚本:
/Users/myname/.rbenv/shims
/Users/myname/.rbenv/shims
/Users/myname/.rbenv/shims
/Users/myname/.rbenv/shims
/Users/myname/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rspec-3.4.0/lib/rspec.rb
/Users/myname/Tools/apache-maven-3.2.5/bin
/Users/myname/Tools/apache-maven-3.2.5/bin
/bin
/opt/ImageMagick/bin
/sbin
/usr/bin
/usr/bin/local/bin
/usr/bin/local/bin
/usr/local/bin
/usr/local/git/bin
/usr/local/git/bin
/usr/local/git/bin
/usr/local/git/bin
/usr/local/git/bin
/usr/local/git/bin
/usr/local/heroku/bin
/usr/local/heroku/bin
/usr/local/mysql/bin
/usr/local/mysql/bin
/usr/sbin
另见: https://github.com/rbenv/rbenv/wiki/Understanding-binstubs http://dan.carley.co/blog/2012/02/07/rbenv-and-bundler/