1
votes

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?

2
type which ruby and show result. then ls /Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin - Малъ Скрылевъ
it seems that this /Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin/ruby is the link, it is broken. but please show ls -l /Users/wroberts/.rvm/gems/ruby-1.8.7-p374/bin - Малъ Скрылевъ
you have strange location of interpreter, in my rvm installation it is placed to ~/.rvm/rubies - Малъ Скрылевъ
Append the output of rvm info to your question please. - the Tin Man
Check your directory/directories for .rvmrc and other RVM configuration files. They override the command-line settings. See "rvmrc files" and "Typical RVM Project Workflow" for more information. - the Tin Man

2 Answers

1
votes

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.

0
votes

Do:

rvm implode
install rvm

again. This should fix the issue.