1

安装 OSX 10.8.5 后,我开始出现一些错误,在仔细阅读 stackoverflow 中不同的帖子后,我没有找到正确的答案。我将非常感谢您的帮助

$ rvm -v

rvm 1.23.9 (stable) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]

.

  $ ruby -v
    ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.5.0]

.

$ rails -v
-bash: rails: command not found

.

   $ gem -v
    /usr/local/lib/ruby/2.0.0/yaml.rb:4:in `<top (required)>':
    It seems your ruby installation is missing psych (for YAML output).
    To eliminate this warning, please install libyaml and reinstall your ruby.
    /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': dlopen(/usr/local/lib/ruby/2.0.0/x86_64-darwin12.5.0/psych.bundle, 9): Library not loaded: /usr/local/lib/libyaml-0.2.dylib (LoadError)
      Referenced from: /usr/local/lib/ruby/2.0.0/x86_64-darwin12.5.0/psych.bundle
      Reason: image not found - /usr/local/lib/ruby/2.0.0/x86_64-darwin12.5.0/psych.bundle
        from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/ruby/2.0.0/psych.rb:1:in `<top (required)>'
        from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/ruby/2.0.0/yaml.rb:5:in `<top (required)>'
        from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
        from /usr/local/lib/ruby/2.0.0/rubygems.rb:595:in `load_yaml'
        from /usr/local/lib/ruby/2.0.0/rubygems/config_file.rb:313:in `load_file'
        from /usr/local/lib/ruby/2.0.0/rubygems/config_file.rb:190:in `initialize'
        from /usr/local/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `new'
        from /usr/local/lib/ruby/2.0.0/rubygems/gem_runner.rb:66:in `do_configuration'
        from /usr/local/lib/ruby/2.0.0/rubygems/gem_runner.rb:46:in `run'
        from /usr/local/bin/gem:21:in `<main>'

当我尝试安装 libyaml 时,我有一些警告

$ sudo rvm pkg install libyaml 

Beware, 'rvm pkg ...' is deprecated, read about the new autolibs feature: 'rvm help autolibs'.

Checking requirements for osx.
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 21: /usr/local/Library/brew.rb: Undefined error: 0
Installing requirements for osx.
Updating system.....
Error running 'requirements_osx_brew_update_system libyaml',
please read /Users/jcr/.rvm/log/1382177136/update_system.log
Requirements installation failed with status: 1.
Fetching yaml-0.1.4.tar.gz to /Users/jcr/.rvm/archives
Extracting yaml to /Users/jcr/.rvm/src/yaml-0.1.4
Prepare yaml in /Users/jcr/.rvm/src/yaml-0.1.4..
Error running '__rvm_autoreconf -is --force',
please read /Users/jcr/.rvm/log/1382177136/yaml_autoreconf.log
Configuring yaml in /Users/jcr/.rvm/src/yaml-0.1.4..........................................................................................
Compiling yaml in /Users/jcr/.rvm/src/yaml-0.1.4..................................................................................
Installing yaml to /Users/jcr/.rvm/usr......................................

Please note that it's required to reinstall all rubies:

    rvm reinstall all --force

.

 $ sudo rvm reinstall all --force
 $

非常感谢您的帮助

4

2 回答 2

2

首先,永远不要sudo rvm将 sudo 与 rvm 一起使用会导致您想要避免的各种文件权限问题。

更多信息在这里:http ://rvm.io/rubies/rubygems

如果您一直在使用sudo gem install ..,您可以通过运行来修复您的 rvm 权限

sudo chown -R $USER: ~/.rvm

无论如何,要安装 libyaml,您应该使用自制软件。看起来你需要安装 libyaml 然后重新安装你的 Ruby。尝试:

$ brew install libyaml
$ rvm reinstall 2.0.0

编辑:

根据您上面的代码,您似乎对自制软件有一些问题。尝试运行

$ brew doctor
$ rvm install ruby-2.0.0-p247

如果这些运行完成,那么您可以再次尝试 libyaml。

$ brew install libyaml

如果这些仍然返回该bad interpreter: no such file or directory错误,请尝试修复它。

使用 brew 时出现“错误的解释器”错误

于 2013-10-19T12:12:50.150 回答
0

/usr/local/lib/ruby/2.0.0/不是 RVM Ruby - 你需要说rvm使用已安装的 ruby​​:

rvm list

它将显示如下内容:

   ruby-1.9.3-p448 [ x86_64 ]
   ruby-2.0.0-p247 [ x86_64 ]

你可以说 rvm 来使用 2.0.0 ruby​​:

rvm use 2.0.0-p247

另一个答案也是正确的-永远不要使用sudo

于 2013-10-19T13:57:00.197 回答