RVM treats new ruby like default ruby - rvm

I installed ruby 2.0.0 for the first time (probably with clang? on accident). Now RVM behaves like ruby 2.0.0 is the default ruby.
I have a .ruby-version with ruby 2.0.0 in a project directory. When I cd from that directory to my home directory, where there is no .ruby-version or .rvmrc, RVM did not switch my ruby back to the default 1.8.7-p370. Even more weird, when I switched from a different project using 1.9.3 to my home directory, rvm switched the ruby from 1.9.3 to 2.0.0.
Yet when I use rvm list, the ruby marked as the default (with an asterisk) is still 1.8.7-p370.
How can I make 1.8.7 the default again?
Alternate titles:
RVM does not switch to the default ruby
RVM not switching to the default ruby

RVM makes the first installed ruby the default one, if this is not desired behavior just remove the default alias:
rvm alias delete default
and there will be no default ruby, alternatively set other ruby as default:
rvm use 1.9.3 --default #OR:
rvm alias create default 1.9.3

The same way you set the default when RVM is behaving normally:
rvm --default use 1.8.7

Related

Rails 4.0.8 Bundle Install keeps poiting to the wrong Ruby version

I'm working through the Railstutorial with Rails 4.0.8. and Ruby 2.1.2. Recently Bundle Install, Rails Console and Rails Server seem to ALWAYS choose the alternate version of Ruby from whichever is specify in my Gemfile. When I enter ruby -v it also always suggests the OTHER version.
Is this a bash_profile problem and how can I set it to permanently leave the internal OS X Ruby (v2.0.0) alone and just use v 2.1.2 where all my gems are installed?
I'm using rvm and Homebrew... I suspect both may be adding to the confusion...
Any helpful tips?
First...
micanansmbp:sample_app micanan$ rails console
Your Ruby version is 2.1.2, but your Gemfile specified 2.0.0
Then...
micanansmbp:sample_app micanan$ bundle install
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2
Finally...
micanansmbp:sample_app micanan$ bundle install
Your Ruby version is 2.0.0, but your Gemfile specified 2.1.2
micanansmbp:sample_app micanan$ ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
micanansmbp:sample_app micanan$

Passenger using Ruby system version instead of Ruby from RVM

I'm using RVM (1.19), Passenger (3.0.19), Apache on a Debian environment.
I tried update the ruby version from 1.8.7 to 1.9.3 using RVM. The following steps were executed:
rvm install 1.9.3
rvm rvmrc to .ruby-version (in my Rails app folder)
rvm use 1.9.3 & gem install passenger & rvm passenger-install-apache2-module (to install passenger and apache2-module in my 1.9.3 environment)
updated 'mod_rails.load' file in '/etc/apache2/mods-available/':
LoadModule passenger_module /usr/local/rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/rvm/gems/ruby-1.9.3-p392/gems/passenger-3.0.19
PassengerRuby /usr/local/rvm/wrappers/ruby-1.9.3-p392/ruby
And finally, I restarted the apache server.
After all, my application is still using Ruby 1.8.7 and Passenger is getting gems from '/var/lib/gems/1.8/gems/'. So I guess Passenger is ignoring the configuration in mod_rails.load.
Does anyone know how resolve this problem?
what does ruby -v output?
if it is 1.8.7 try rvm use 1.9.3 and be sure that 1.9.3 is set as the default.
rvm default 1.9.3
and that your .rvmrc is sourced in your .bash_profile something like:
`[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"`
also what does which rvm return? that should be the start of file path you use to load gems from. its normally something like /Users/local/.rvm

How do I generate documentation using rvm after a reinstall?

I installed RVM as per the instructions on http://rvm.io. Here's what I've done: rvm list:
rvm rubies
=* ruby-1.9.3-p194 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Followed by a ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.4.0]
And then a rvm docs generate:
Currently 'rvm docs ...' does not work with non-rvm rubies.
I then tried rvm reinstall 1.9.3 && rvm docs generate. This resulted in the rvm giving me the above error.
How do I generate docs with rvm?
you need to use ruby first:
rvm use 1.9.3
I am using the rvm binary (i.e. I did not build it from sources). See this git issue for more details. Doing a rvm reinstall 1.9.3 --disable-binary will build rvm from source and allow you to generate docs with rvm. (At least for version 1.9.3)

How do I install same version of ruby as different names with rvm?

After I installed a version of ruby with rvm, I noticed that some minor configuration issue on installation process. So I wanted to try to install with another configuration options, but I don't want to spoil the installed ruby at all.
So I just to attempt to backup the installed ruby before rvm reinstall.
(cd .rvm/rubies && mv ruby-1.9.3-p194 ruby-1.9.3-p194.org)
In my case, reinstallation fixed the issue, I didn't rollback ruby. So, I don't know this can work.
Are there any clean or correct way? Just for future references.
you can install named rubies:
rvm install 1.9.3-test1 [options]
and after it worked set it as default:
rvm use 1.9.3-test1 --default
or reinstall the original 1.9.3, named rubies are useful especially for testing compilation flags or patched rubies:
rvm install 1.9.3-performance --patch falcon
You can also have different gemsets with the same version using
rvm create gemset projectname

Moving my RVM project gemset to another patchlevel

My project has an .rvmrc file with the following: rvm 1.9.2-p180#project_name. However, I just updated my ruby 1.9.2 to the latest patch level (1.9.2-p290). Is there any way to migrate the gems in the project_name gemset to 1.9.2-p290?
You can copy gemsets with the following command:
rvm gemset copy 1.9.2-p180#project_name 1.9.2-p290#project_name
Reference: http://ruby.about.com/od/rubyversionmanager/ss/Upgrading-To-1-9-2-Using-Rvm_6.htm
Alternatively, your gemsets can be migrated (or moved) from one version of Ruby to another. Remember that migrate moves gemsets, not leaving a copy behind. But if you wish to do it this way, you can run the following command.
rvm migrate 1.9.2-p180#project_name 1.9.2-p290#project_name