Joseph
Joseph

Reputation: 55

Multiple error with rails and gem installation

After installing OSX 10.8.5 I started to have some errors and after reading carefully diferents posts in stackoverflow I didn't find the correct answer. I will really appreciate your help

$ 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>'

When I try to install libyaml I have some warnings

$ 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
 $

Thank you very much for your help

Upvotes: 1

Views: 3921

Answers (2)

Anthony To
Anthony To

Reputation: 2303

First off, never use sudo rvm using sudo with rvm causes all kinds of file permissions issues that you want to avoid.

More info here: http://rvm.io/rubies/rubygems

If you've been using sudo gem install .. you can fix your rvm permissions by running

sudo chown -R $USER: ~/.rvm

Anyways, to install libyaml you should be using homebrew. Looks like you need to install libyaml then reinstall your Ruby. Try:

$ brew install libyaml
$ rvm reinstall 2.0.0

EDIT:

Based on your code above, looks like you have some issues with homebrew. Try running

$ brew doctor
$ rvm install ruby-2.0.0-p247

If those run to completion then you can try libyaml again.

$ brew install libyaml

If these are still returning that bad interpreter: no such file or directory error then try this to fix it.

Getting a "bad interpreter" error when using brew

Upvotes: 2

mpapis
mpapis

Reputation: 53178

/usr/local/lib/ruby/2.0.0/ is not RVM Ruby - you need to say rvm to use the installed ruby:

rvm list

it will show something like:

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

you can say rvm to use the 2.0.0 ruby with:

rvm use 2.0.0-p247

also the other answer is true also - never use sudo

Upvotes: 0

Related Questions