我的ruby命令都不起作用。 最初我试图在一个生成项目的过程中让指南针与Grunt一起工作,但不知怎的,我搞砸了计算机上的所有东西。
它是一款较旧的Mac,我无法将操作系统升级到10.6.8以上。 (雪豹)
Ruby -v
:ruby 2.1.3p242 (2014-09-19 revision 47630) [x86_64-darwin10.0]
如果我输入任何gem
命令,我会得到以下内容:
Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb:219:in `raw_require_paths': NotImplementedError (NotImplementedError)
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/basic_specification.rb:240:in `require_paths'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems.rb:1098:in `register_default_spec'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:773:in `block in load_defaults'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:738:in `block in each_spec'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:723:in `block (2 levels) in each_gemspec'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:722:in `each'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:722:in `block in each_gemspec'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:721:in `each'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:721:in `each_gemspec'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:736:in `each_spec'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems/specification.rb:770:in `load_defaults'
from /Users/home/.rbenv/versions/2.1.3/lib/ruby/site_ruby/2.1.0/rubygems.rb:1239:in `<top (required)>'
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'
我的.bash_profile看起来像这样:
export PATH=/usr/local/bin:$PATH
alias ll="ls -lahG"
export NODE_PATH="/usr/local/lib/node"
export PATH="/usr/local/share/npm/bin:$PATH"
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH"
#export PATH=/bin:/usr/bin:"$PATH"
export PATH="/usr/local/mysql/bin:$PATH"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # This loads RVM into a shell session.
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" #Load RVM function
if [ -f ~/.git-completion.bash ]; then
source ~/.git-completion.bash
fi
eval "$(rbenv init -)"
##
# Your previous /Users/home/.bash_profile file was backed up as /Users/home/.bash_profile.macports-saved_2016-10-31_at_23:29:59
##
# MacPorts Installer addition on 2016-10-31_at_23:29:59: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
答案 0 :(得分:0)
我通过从How to upgrade ruby and rails in mac os snow leopard
部分遵循这些说明来修复它RVM(Ruby Version Manager)是升级Ruby的标准 在OSX上安装:https://rvm.io(任何平台 - 包括OSX Snow 豹)
要开始使用,请打开终端窗口并发出以下命令 命令:
\curl -L https://get.rvm.io | bash -s stable --ruby
然后我发出警告,我需要将rvm cleanup all
与the --auto-dotfiles
标志
我然后rvm use ruby-1.9.3-p194@global
到之前的安装有效。