2013-10-19 14 views
1

安裝OSX 10.8.5後,我開始有一些錯誤,並仔細閱讀stackoverflow後帖子我沒有找到正確的答案。我會很感激你的幫助與鐵軌和寶石安裝多個錯誤

$ rvm -v 

rvm 1.23.9 (stable) by Wayne E. Seguin <[email protected]>, Michal Papis <[email protected]> [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 
$ 

非常感謝您的幫助

回答

2

首先,使用sudo與RVM導致要避免各種文件的權限問題,從不使用sudo rvm

這裏更多的信息:通過運行

sudo chown -R $USER: ~/.rvm

不管怎麼說,安裝libyaml你應該使用自制http://rvm.io/rubies/rubygems

如果您已經使用sudo gem install ..就可以解決您的RVM權限。看起來你需要安裝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錯誤,那麼試試這個修復它。

Getting a "bad interpreter" error when using brew

0

/usr/local/lib/ruby/2.0.0/不RVM紅寶石 - 你需要說rvm使用已安裝的紅寶石:

rvm list 

它會顯示類似:

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

你可以說RVM使用2.0.0紅寶石:

rvm use 2.0.0-p247 

另外答案也是如此 - 永不使用sudo