gem install fails in RVM, El Capitan 10.11 - ruby

Is this because of the empty GEM_HOME variable on Environment?
I couldn't figure it out for hours..
➜ ~ gem install mysql
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory -
➜ ~ mysql --version
mysql Ver 14.14 Distrib 5.7.10, for osx10.11 (x86_64) using EditLine wrapper
➜ ~ gem install mysql2
Fetching: mysql2-0.4.2.gem (100%)
ERROR: While executing gem ... (Errno::ENOENT)
No such file or directory -
➜ ~ rvm info
system:
system:
uname: "Darwin Seos-MacBook.local 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64"
system: "osx/10.11/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)"
zsh: "/bin/zsh => zsh 5.0.8 (x86_64-apple-darwin15.0)"
rvm:
version: "rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "21 minutes 30 seconds ago"
path: "/Users/seoyoochan/.rvm"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/Users/seoyoochan/.rvm/bin:/usr/local/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/Applications/Postgres.app/Contents/Versions/9.4/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
➜ ~

Thanks for the comments guys, I just fixed it myself.
When i checked the version of gem, it was very old (probably 2.0.4)
trying to do gem update --system was also failed, so i added sudo.
sudo gem update --system did solve the issue.

Related

RVM breaks gems, looking in wrong Ruby version

I have ruby 2.2.0 and I use RVM for a project that requires 2.0.0
After installing RVM I tried to use sass or compass gems outside the project and got this:
$ compass watch
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:296:in `to_specs': Could not find 'compass' (>= 0) among 49 total gem(s) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/dependency.rb:307:in `to_spec'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/compass:22:in `<main>'
I tried removing RVM and reinstalling the gems and all worked fine, but I need it for the project.
Why is it looking in 2.0 folder? When I do rvm info I get ruby-2.2.0:
Update:
$ which ruby
/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/ruby
$ which compass
/usr/bin/compass
$rvm info
ruby-2.2.0:
system:
uname: "Darwin ilyo-audyx.local 14.0.0 Darwin Kernel Version 14.0.0: Fri Sep 19 00:26:44 PDT 2014; root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64"
system: "osx/10.10/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.53(1)-release (x86_64-apple-darwin14)"
zsh: "/bin/zsh => zsh 5.0.5 (x86_64-apple-darwin14.0)"
rvm:
version: "rvm 1.26.9 (latest) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "4 days 7 hours 57 minutes 33 seconds ago"
path: "/Users/ilyo/.rvm"
ruby:
interpreter: "ruby"
version: "2.2.0p0"
date: "2014-12-25"
platform: "x86_64-darwin14"
patchlevel: "2014-12-25 revision 49005"
full_version: "ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]"
homes:
gem: "/Users/ilyo/.rvm/gems/ruby-2.2.0"
ruby: "/Users/ilyo/.rvm/rubies/ruby-2.2.0"
binaries:
ruby: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/ruby"
irb: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/irb"
gem: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/gem"
rake: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin/rake"
environment:
PATH: "/Users/ilyo/.rvm/gems/ruby-2.2.0/bin:/Users/ilyo/.rvm/gems/ruby-2.2.0#global/bin:/Users/ilyo/.rvm/rubies/ruby-2.2.0/bin:/Users/ilyo/.rvm/bin:/usr/local/bin:/Users/ilyo/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
GEM_HOME: "/Users/ilyo/.rvm/gems/ruby-2.2.0"
GEM_PATH: "/Users/ilyo/.rvm/gems/ruby-2.2.0:/Users/ilyo/.rvm/gems/ruby-2.2.0#global"
MY_RUBY_HOME: "/Users/ilyo/.rvm/rubies/ruby-2.2.0"
IRBRC: "/Users/ilyo/.rvm/rubies/ruby-2.2.0/.irbrc"
RUBYOPT: ""
gemset: ""

Using Bundler, RVM and RubyGems

I seem to be getting an odd issue here, not sure where to look to debug it. I have had Ruby installed on my machine for a while now but today have added RVM. So I will run through the steps I am taking:
My Gemfile:
source 'https://rubygems.org'
gem 'capistrano', '~> 3.1.0'
Try to install:
$ bundle
Fetching gem metadata from https://rubygems.org/.......
Installing rake (10.2.1)
Gem::InstallError: rake requires Ruby version >= 1.9.
An error occured while installing rake (10.2.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.2.1'` succeeds before bundling.
Check Ruby version, which is greater than 1.9:
$ ruby -v
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
Make sure rake is installed:
$ gem list
*** LOCAL GEMS ***
...
rake (10.2.1)
...
Try installing rake anyway:
$ sudo gem install rake -v '10.2.1'
Successfully installed rake-10.2.1
Parsing documentation for rake-10.2.1
1 gem installed
Make sure rake is installed:
$ gem list
*** LOCAL GEMS ***
...
rake (10.2.1)
...
Try again:
$ bundle
Fetching gem metadata from https://rubygems.org/.......
Installing rake (10.2.1)
Gem::InstallError: rake requires Ruby version >= 1.9.
An error occured while installing rake (10.2.1), and Bundler cannot continue.
Make sure that `gem install rake -v '10.2.1'` succeeds before bundling.
Perhaps some useful information:
$ rvm info
system:
system:
uname: "Darwin ians-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64"
system: "osx/10.9/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.25.22 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "3 hours 34 minutes 31 seconds ago"
path: "/Users/ianjamieson/.rvm"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/usr/bin/rake"
environment:
PATH: "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Applications/android-developer-tools/sdk/platform-tools:/Applications/android-developer-tools/sdk/tools:/usr/lib/apache-ant-1.9.2/bin:/usr/local/mysql/bin:/Applications/android-developer-tools/sdk/platform-tools:/Applications/android-developer-tools/sdk/tools::/usr/lib/apache-ant-1.9.2/bin:/usr/local/mysql/bin:/Users/ianjamieson/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
Thanks.
The fix for me was:
$ rvm reinstall 2.1.1
It seems as though, when I installed this version the first time round it didn't complete correctly and didn't update all the paths. So gem install was installing my gems in the wrong place.

rvm info has different version that ruby

After installing rvm and modifying my .zshrc file when running rvm info i get a different version that when i type ruby -v and when trying to install a gem i get a bunch of errors relating to the system ruby
rvm info output:
$ rvm info
ruby-2.1.1:
system:
uname: "Darwin Joshs-MacBook-Pro.local 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64"
system: "osx/10.9/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.51(1)-release (x86_64-apple-darwin13)"
zsh: "/bin/zsh => zsh 5.0.2 (x86_64-apple-darwin13.0)"
rvm:
version: "rvm 1.25.20 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "3 hours 4 minutes 13 seconds ago"
path: "/Users/joshburns/.rvm"
ruby:
interpreter: "ruby"
version: "2.0.0p247"
date: "2013-06-27"
platform: "universal.x86_64-darwin13"
patchlevel: "2013-06-27 revision 41674"
full_version: "ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]"
homes:
ZSH=$HOME/.oh-my-zsh
gem: "/Users/joshburns/.rvm/gems/ruby-2.1.1"
ruby: "/Users/joshburns/.rvm/rubies/ruby-2.1.1"
binaries:
ruby: "/usr/bin/ruby"
irb: "/usr/bin/irb"
gem: "/usr/bin/gem"
rake: "/Users/joshburns/.rvm/gems/ruby-2.1.1/bin/rake"
environment:
PATH: "/Users/joshburns/.rvm/gems/ruby-2.1.1/bin:/Users/joshburns/.rvm/gems/ruby-2.1.1#global/bin:/Users/joshburns/.rvm/rubies/ruby-2.1.1/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/Users/joshburns/bin:/Users/joshburns/.rvm/bin"
GEM_HOME: "/Users/joshburns/.rvm/gems/ruby-2.1.1"
GEM_PATH: "/Users/joshburns/.rvm/gems/ruby-2.1.1:/Users/joshburns/.rvm/gems/ruby-2.1.1#global"
MY_RUBY_HOME: "/Users/joshburns/.rvm/rubies/ruby-2.1.1"
IRBRC: "/Users/joshburns/.rvm/rubies/ruby-2.1.1/.irbrc"
RUBYOPT: ""
gemset: ""
ruby -v output:
ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13]
I think I have had a similar problem but found the solution here:
http://www.intelligentbee.com/blog/2013/09/17/setup-a-simple-ruby-2-on-rails-4-environment-with-vagrant-and-virtual-box/
Look for the bit:
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
rvm use ruby-2.0.0-p247 (replace with your ruby version)

Why is RVM trying to install Rubygems instead of Ruby with the 'rvm install' command?

I'm trying to install Ruby 2.0 on my Debian server and decided to do this via RVM. I downloaded it using:
~$ \curl -L https://get.rvm.io | bash -s stable
But when I try to install Ruby, it looks like RVM is trying to install Rubygems instead.
~$ rvm install 2.0.0
=> 'ruby' was not found, cannot install rubygems unless ruby is present (Do you have an RVM ruby installed & selected?)
I've checked the RVM documentation and rvm install <ruby version> is definitely the command for installing Ruby, not Rubygems. So why is the issue above occuring? Thank you!
EDIT:
Output of 'rvm info':
[name]#debian-server:~/.rvm/rubies$ rvm info
system:
uname: "Linux debian-server 3.2.0-4-amd64 #1 SMP Debian 3.2.41-2+deb7u2 x86_64 GNU/Linux"
system: "debian/7/x86_64"
bash: "/bin/bash => GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.24.5 (stable) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "33 minutes 56 seconds ago"
path: "/home/[name]/.rvm"
homes:
gem: "not set"
ruby: "not set"
binaries:
ruby: ""
irb: ""
gem: ""
rake: "/home/[name]/.rvm/bin/rake"
environment:
PATH: "/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/home/[name]/.rvm/bin"
GEM_HOME: ""
GEM_PATH: ""
MY_RUBY_HOME: ""
IRBRC: ""
RUBYOPT: ""
gemset: ""
Output of 'rvm requirements':
~$ rvm requirements
Checking requirements for debian. Requirements installation successful.
I'm not sure I understand how you arrived at this situation, but if you want ruby 2.0 installed via RVM, then I would suggest the following:
rvm implode
\curl -L https://get.rvm.io | bash -s stable --ruby
Then make sure you source ~/.bash_profile (as mentioned in the installation output) to load RVM in each new shell.

Ruby not starting on mac os x

when I try to use ruby with the terminal, nothing happens.
The last days I've used it and everything worked but it doesn't anymore.
I installed rvm and the 1.9.3 version of ruby.
It works when I launch a script with ruby myscript.rb, and I tried installing rails but when I type gem install rails I get an error:
/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/gem:4: warning: Insecure world writable dir /Users/romainberger/.rvm/gems/ruby-1.9.3-p194 in PATH, mode 040777
As there is no output I don't know where the problem comes from. Does anybody have an idea?
Thanks
EDIT:
rvm info
ruby-1.9.3-p194:
system:
uname: "Darwin romain.home 11.3.0 Darwin Kernel Version 11.3.0: Thu Jan 12 18:47:41 PST 2012; root:xnu-1699.24.23~1/RELEASE_X86_64 x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin11)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin11.0)"
rvm:
version: "rvm 1.14.1 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]"
updated: "1 day 11 hours 59 minutes 3 seconds ago"
ruby:
interpreter: "ruby"
version: "1.9.3p194"
date: "2012-04-20"
platform: "x86_64-darwin11.3.0"
patchlevel: "2012-04-20 revision 35410"
full_version: "ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]"
homes:
gem: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194"
ruby: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194"
binaries:
ruby: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/ruby"
irb: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/irb"
gem: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin/gem"
rake: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194#global/bin/rake"
environment:
PATH: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194/bin:/Users/romainberger/.rvm/gems/ruby-1.9.3-p194#global/bin:/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/bin:/Users/romainberger/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin"
GEM_HOME: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194"
GEM_PATH: "/Users/romainberger/.rvm/gems/ruby-1.9.3-p194:/Users/romainberger/.rvm/gems/ruby-1.9.3-p194#global"
MY_RUBY_HOME: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194"
IRBRC: "/Users/romainberger/.rvm/rubies/ruby-1.9.3-p194/.irbrc"
RUBYOPT: ""
gemset: ""
gem info gives me:
ERROR: While executing gem ... (RuntimeError)
Unknown command info
And to launch ruby I just type ruby
To fix the gem warning use:
chmod -R go-w /Users/romainberger/.rvm/
It will recursively remove write right for group and others (keeps write for user).
You can check for RVM related resurces on RVM site: https://rvm.io/

Resources