Because of a legacy system, I need to use Ruby v1.8.7-p374. I've been using RVM to use that version of Ruby and all seemed to work well, until something changed.
Now my system will not use the Ruby version that I'm specifying with RVM. Is there a way to switch between the Ruby versions manually?
Related question: "Can't change Ruby Version using RVM"
Here are some relevant pieces of information:
$ rvm --default use ruby-1.8.7-p374
Using /Users/wroberts/.rvm/gems/ruby-1.8.7-p374
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
$ echo $PATH
/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin:/Users/wroberts/.rvm/gems/ruby-1.8.7-p374#global/bin:/Users/wroberts/.rvm/rubies/ruby-1.8.7-p374/bin:/Users/wroberts/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/ant/bin:/usr/local/mysql/bin:/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk/Contents/Home/bin:/usr/local/apache-maven/apache-maven-3.2.3/bin:/usr/bin/chromedriver/bin:/Users/wroberts/dev/tools/flex:/usr/local/bin:/usr/bin:/usr/sbin
$ rvm list
rvm rubies
ruby-1.8.7-head [ i686 ]
=* ruby-1.8.7-p374 [ i686 ]
# => - current
# =* - current && default
# * - default
$ which ruby
/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin/ruby
$ ls /Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin/ruby
/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin/ruby
$ rvm info
RVM version 1.26.4 (master) is installed yet 1.26.4 (latest) is loaded.
Please do one of the following:
* 'rvm reload'
* open a new shell
* 'echo rvm_auto_reload_flag=1 >> ~/.rvmrc' # for auto reload with msg.
* 'echo rvm_auto_reload_flag=2 >> ~/.rvmrc' # for silent auto reload.
Even more issues now:
$ rvm install 1.8.7 --without-tcl --without-tk
Warning! PATH is not properly set up, '/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-1.8.7-p374'.
Warning! Requested ruby installation which requires another ruby available - installing ruby-1.8.7-p374 first.
Checking requirements for osx.
/usr/local/bin/brew: /usr/local/Library/brew.rb: /System/Library/Frameworks/Ruby.framework/Versions
/Current/usr/bin/ruby: bad interpreter: No such file or directory
/usr/local/bin/brew: line 28: /usr/local/Library/brew.rb: Undefined error: 0
ERROR: '/bin' is not writable - it is required for Homebrew, try 'brew doctor' to fix it!
Requirements installation failed with status: 1.
To proceed rvm requires a ruby-1.8.7-p374 compatible ruby is installed.
We attempted to install it automatically but it failed with status 1.
Please install it manually (or a compatible alternative) to proceed.
IT IS WORKING -- my workaround, and one more question
so I did the rvm implode, which (I think) resulted in ruby not being in the System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby.
So everytime I tried to install 1.8.7 --without-tcl --without-tk something was wrong with my brew file.
A FEW FINAL QUESTIONS:
I checked the brew file and at the top it was using
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby -W0
and I changed it to
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
and now brew worked, I was able to install 1.8.7 and do rvm --default use ruby-1.8.7-p374 and my gems install etc.
First question, is this hacky solution a major issue for me, not a big deal, or unknown territory due to sheer stupidity of the problem?
Second question, everytime I open a new bash shell ruby -v gives me the (I believe) system version of ruby:
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]
$ which ruby
/usr/bin/ruby
but then I set the default rvm and would like this to happen automatically,
$ rvm --default use ruby-1.8.7-p374
Warning! PATH is not properly set up, '/Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-1.8.7-p374'.
Using /Users/wroberts/.rvm/gems/ruby-1.8.7-p374
$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin13.4.
$ which ruby
/Users/wroberts/.rvm/rubies/ruby-1.8.7-p374/bin/ruby
It says my path is not properly set up, but if you check the top of this post, /Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin IS at the first place, how can this be fixed?
RVM is telling you that it doesn't like the configuration of your shell. So try running
rvm get stable --auto-dotfiles
as it suggests. RVM needs to be the last thing included in your shell config otherwise its functionality can be affected by shell commands loaded after it.
If you are using homebrew, I'd do an update and doctor.
Do:
rvm implode
install rvm
again. This should fix the issue.
Related
I am trying to install Jekyll in a VM for my web course and it required ruby >= 2.0.0.
I've gone through installing RVM and using this to install the desired version of ruby, but I then get the following:
vagrant#precise32:~/.rvm/bin$ bash rvm list
rvm rubies
ruby-2.1.1 [ i686 ]
=* ruby-2.2.1 [ i686 ]
# => - current
# =* - current && default
# * - default
vagrant#precise32:~/.rvm/bin$ ruby -v
ruby 1.8.7 (2011-06-30
patchlevel 352) [i686-linux]
vagrant#precise32:~/.rvm/bin$ sudo gem
install jekyll ERROR: Error installing jekyll:jekyll requires Ruby version >= 2.0.0.
vagrant#precise32:~/.rvm/bin
I don't understand why it still thinks it is using version 1.8.7, as it confirms that it has installed 2.2.1.
I have done the following:
Use sudo chown to change ownership of the .gnupg folder recursively to vagrant (my system user) as defined here.
Install RVM following the instructions here.
Installed the version (2.2.1) of ruby using these instructions (https://rvm.io/rubies/installing).
Tried to install Jekyll using sudo gem install jekyll, but I get an error saying that I need ruby version 2.0 or higher.
I'm not a developer, this is an introductory web development course. Also please excuse the corrupt link, I can't post more than 2.
Update: I think I might need to do something as described here: How do I change my Ruby version using RVM?.
Also - although I installed RVM, I originally installed it using sudo apt-get which corrupted it. I uninstalled that, and ran the most recent install with curl. To use it I have to navigate to the directory and use "bash rvm list"
Add following two lines:
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
to your $HOME/.profile file and restart a shell.
It seems your machine is using Its own instead by RVM.
1: rvm list # Listing install rubies will you get versions of ruby which is installed by RVM
2: rvm use < ruby-version > # for instances ruby-1.9.3-p125
3: bundle install
4: Tried to install Jekyll using sudo gem install jekyll, but I get an
error saying that I need ruby version 2.0 or higher.
For that you could try Installing Jekyll on Ubuntu 14.04
Hope this help you !!!
This is such a pain. It's happened before but still unable to figure it out.
[~]$ rvm use 2.1.5
Using /Users/snowcrash/.rvm/gems/ruby-2.1.5
[~]$ rvm get head
Downloading https://get.rvm.io
No GPG software exists to validate rvm-installer, skipping.
Downloading https://github.com/rvm/rvm/archive/master.tar.gz
Upgrading the RVM installation in /Users/snowcrash/.rvm/
RVM PATH line found in /Users/snowcrash/.mkshrc /Users/snowcrash/.profile /Users/snowcrash/.bashrc /Users/snowcrash/.zshrc.
RVM sourcing line found in /Users/snowcrash/.profile /Users/snowcrash/.bash_profile /Users/snowcrash/.zlogin.
Installing rvm gem in 1 gemsetsError running 'command gem install /Users/snowcrash/.rvm/gem-cache/rvm-1.11.3.9.gem --local --no-ri --no-rdoc',
showing last 15 lines of /Users/snowcrash/.rvm/log/1434304025_ruby-2.0.0-p195/gem.install.rvm->=1.11.3.9.log
[2015-06-14 13:47:05] command
current path: /Users/snowcrash/.rvm/src/rvm
GEM_HOME=/Users/snowcrash/.rvm/gems/ruby-2.0.0-p195#global
PATH=/Users/snowcrash/.rvm/gems/ruby-2.0.0-p195#global/bin:/Users/snowcrash/.rvm/rubies/ruby-2.0.0-p195/bin:/Users/snowcrash/.rvm/bin:/Library/Frameworks/Python.framework/Versions/2.6/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/Current/bin:/usr/bin:/Users/snowcrash/Library/ec2-api-tools-1.3-24159/bin:/Users/snowcrash/bin:/Users/snowcrash/Library/android-sdk-mac_86:/Users/snowcrash/Library/android-sdk-mac_86/platform-tools:/Users/snowcrash/Library/bin:/usr/local/mysql/bin:/Library/PostgreSQL/9.1/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/snowcrash/bin/gsutil:/usr/local/graphviz-2.14/bin
GEM_PATH=/Users/snowcrash/.rvm/gems/ruby-2.0.0-p195#global
I've checked .bash_profile files, etc but all seem to use 2.1.5. Where is 2.0.0 coming from?
Your error message states "No GPG software exists". You will need to install grpg2 first. You can do that with brew:
brew install gpg2
If you want to set the default, then you need to do
rvm --default use 2.1.5
then ruby -v should have the correct version.
Source
Run the following code
rvm use 2.1.5 --default
You should see
Using ... /ruby-2.1.5
Or you can check by typing ruby -v
I want to install the compass html5 boilerplate gem. When I try to install it I get the following error.
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
Then when I check my ruby version it says:
$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
But I used RVM before so I thought I could just change version but when I check it says I'm using ruby-2.2.0 already.
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
I think I must be missing something obhvious, it's been a while since I've worked with Ruby and RVM.
Update 1
I ran the below commands as suggested by #tadman and it does seem the wrong path is being used.
~:$ cd ~/.rvm/bin
bin:$ ls
ruby-rvm-env rvm rvm-auto-ruby rvm-exec rvm-prompt rvm-shebang-ruby rvm-shell rvm-smile rvmsudo
bin:$ which ruby
/usr/bin/ruby
UPDATE 2
After correcting the path in my .bash_profile the ruby version seems correct but I'm still getting the same error when trying to install the html5-boilerplate gem??
$ sudo gem install html5-boilerplate
ERROR: Error installing html5-boilerplate:
compass-h5bp requires Ruby version ~> 2.0.
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rvm list
rvm rubies
=* ruby-2.2.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
$ compass -v
Compass 1.0.3 (Polaris)
Copyright (c) 2008-2015 Chris Eppstein
Released under the MIT License.
Compass is charityware.
Please make a tax deductable donation for a worthy cause: http://umdf.org/compass
Also i have the compass gem installed on both Ruby 1.9.1 and RVM's ruby 2.2.0. Could this have something to do with it?
$ pwd
/var/lib/gems/1.9.1/gems/compass-1.0.3
$ cd /home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
$ pwd
/home/ross/.rvm/gems/ruby-2.2.0/gems/compass-1.0.3
Is there a way to check which ruby version compass is using?
Having RVM and having RVM installed correctly are two different things. The most common cause of a mismatch like this is that your system Ruby has priority in your PATH.
In a POSIX shell, which ruby will tell you which one is getting executed. It is probably the wrong one.
RVM does its magic by manipulating which Ruby shows up in the RVM bin path, often ~/.rvm/bin or something similar. To get it to work correctly you'll need to ensure that path is first in your $PATH.
You may want to try reinstalling the RVM stub, or check that it's correctly loaded into your environment.
I have RVM installed on a machine under a single users account on an Ubuntu 10.04 machine, and I want to give the other users of this machine access to that same install.
Is there a way to do this?
In case of binary rubies it should be possible to just move RVM.
Check not movable rubies
You can find if there are any not movable rubies with
rvm all --verbose do rvm config-get configure_args | grep -v -- '--enable-load-relative'
In my case it is (just few):
jruby-1.7.3: jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on OpenJDK 64-Bit Server VM 1.7.0_21-b02 [linux-amd64]
rbx-head: rubinius 2.0.0.rc1 (1.8.7 bed7e913 yyyy-mm-dd JI) [x86_64-unknown-linux-gnu]
ruby-1.8.7-p374: ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]
'--prefix=/home/mpapis/.rvm/rubies/ruby-1.8.7-p374' '--disable-install-doc' '--enable-shared' 'CC=ccache gcc' 'CFLAGS=-O3 -O2 -fno-tree-dce -fno-optimize-sibling-calls'
ruby-1.9.3-p448: ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-linux]
'--prefix=/home/mpapis/.rvm/rubies/ruby-1.9.3-p448' '--disable-install-doc' '--enable-shared' 'CC=ccache gcc'
ruby-2.0.0-p247: ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-linux]
For those rubies that have flags you need to either remove them or reinstall after RVM is moved, in this case this are: 1.8.7 and 1.9.3.
Moving RVM
It should be as easy as:
sudo mv ~/.rvm /usr/local/rvm
__rvm_switch /usr/local/rvm
Simulate installation (to generate shell initialization entries for system installation:
rvmsudo rvm get stable --auto-dotfiles
Now for every user that should be able to use RVM add them to rvm group:
rvmsudo rvm group add rvm $USER
Repeat it for every user replacing $USER with the user name.
Reinstalling not movable rubies
For rubies found in first step run:
rvm reinstall ruby-1.8.7-p374,ruby-1.9.3-p448
Cleaning
The user account that installed RVM in first place will have old initialization code, you can find it with:
grep -n rvm ~/.profile ~/.bashrc ~/.bash_profile ~/.bash_login ~/.zshenv ~/.zprofile ~/.zshrc ~/.zlogin
This will show the lines that contain RVM, open this files in your favorite editor and remove them.
I seriously doubt it's worth trying to convert a single user's installation to multiple-user.
During the installation of a unique Ruby, its path is compiled into components. That will be remembered and would have to be changed.
I think it would be much easier to install using the multi-user method and reload the needed gems. It might take a couple hours if you have multiple Rubies and a lot of gems, but that's a lot better than weeks of debugging weird errors.
I get an "rvm: command not found error" on rvm gemdir, but only when I'm using one of the rvm ruby installations. I get the same result with 1.9.2 and 1.8.7 (the only ones I've tried):
$ rvm install 1.8.7
...
Installation of rubygems completed successfully.
...
Install of ruby-1.8.7-p334 - #complete
# works ok using system ruby
$ rvm gemdir
/Library/Ruby/Gems/1.8
$ rvm use 1.8.7
Using /Users/aneil/.rvm/gems/ruby-1.8.7-p334
#
# HERE IS THE ERROR:
#
$ rvm gemdir
/Users/aneil/.rvm/scripts/gemsets: line 786: rvm: command not found
/Users/aneil/.rvm/gems/ruby-1.8.7-p334
$ rvm use system
Now using system ruby.
$ rvm gemdir
/Library/Ruby/Gems/1.8
Any ideas what's going on here? Should I be concerned?
Thanks.
try running
rvm get latest
from shell. addressed the issue for me.