Ruby keeps reverting to an old version - rvm

I am having some issues with RVM on Ubuntu. My computer is currently set to dual boot with windows 7 if that matters. I am trying to run the latest version of ruby 1.9.3. Each time I close terminal, it will revert to 1.8.7 despite using rvm use 1.9.3 --default. The following was the steps I was using.
michael#michael-Studio-XPS-1640:~$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
michael#michael-Studio-XPS-1640:~$ rvm use 1.9.3
RVM is not a function, selecting rubies with 'rvm use ...' will not work.
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use `/bin/bash --login` as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.
michael#michael-Studio-XPS-1640:~$ /bin/bash --login
michael#michael-Studio-XPS-1640:~$ rvm use 1.9.3 --default
Using /home/michael/.rvm/gems/ruby-1.9.3-p286
michael#michael-Studio-XPS-1640:~$ ruby -v
ruby 1.9.3p286 (2012-10-12 revision 37165) [i686-linux]
After I close and reopen the terminal I get the following verion info. I also added the rvm list information as well.
michael#michael-Studio-XPS-1640:~$ ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
michael#michael-Studio-XPS-1640:~$ rvm list
rvm rubies
=* ruby-1.9.3-p286 [ i686 ]
# => - current
# =* - current && default
# * - default
Thank you guys in advance.

you missed the displayed instructions:
You need to change your terminal emulator preferences to allow login shell.
Sometimes it is required to use /bin/bash --login as the command.
Please visit https://rvm.io/integration/gnome-terminal/ for a example.

Related

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

Passenger on Apache 2 Installation fails with Your RVM wrapper scripts are too old

I'm trying to install passenger on a virtual rootserver (which has multiple user accounts) but running 'passenger-install-apache2-module' results always in the following error:
Your RVM wrapper scripts are too old. Please update them first by running 'rvm get head && rvm reload && rvm repair all'.
Following this given instructions does not take any effect.
Before installing passenger, i installed RVM as multiuser / mixed mode according to https://rvm.io//rvm/install/
After that I did (using a non root-account):
rvmsudo rvm user gemsets
rvm install 1.9.3
gem install rails
gem install passenger
and lastly passenger-install-apache2-module
I searched for hours on this problem but could not find any working solution yet.
Any suggestions ? Thanks in advance!
Try to install passenger-install-apache2-module like this :
rvmsudo passenger-install-apache2-module
I just encountered this very same issue. I'm using ZSH, but switching to Bash also failed on first attempt.
My solution was to switch to Bash with the --login flag:
/bin/bash --login
Then I noticed that my RVM ruby had become unset, so I re-set using:
rvm use ruby-1.9.3 --default
Once this was done, the following worked as expected:
passenger-install-apache2-module
Rich
I have had similar issue and have taken extreme steps on my centos 6.3 system after struggling for days! In specific, I failed to install standalone phusion passenger apache2 module on gemsets other than default and global. I have taken the following steps and now, it works for me:
Login as root (I hope you know what you're dealing with)
To completely uninstall existing rvm, invoke
[root#] rvm implode
Install stable rvm, invoke
[root#] curl -L get.rvm.io | bash -s stable
run rvm shell,
[root#] source /etc/profile.d/rvm.sh
check rvm requirements, invoke
[root#] rvm requirements
and install all requirements.
Install ruby 1.9.3, invoke
[root#] rvm install 1.9.3
Install current rubygems, invoke
rvm rubygems current
Set default to ruby 1.9.3, invoke
[root#] rvm use 1.9.3 --default
Add other users who are using rvm to rvm group, invoke
[root#] usermod -a -G rvm USERNAME
If USERNAME is currently logged in, pls logout so the group add will take effect.
Make sure rvm group added, invoke
[USERNAME#] groups
Create and Switch to a new gemset on ruby 1.9.3, invoke
[USERNAME#] rvm use 1.9.3#mygemset --create
Confirm that you're on the right gemset, invoke
[USERNAME#] rvm gemset name
Install passenger gem, invoke
gem install passenger
To skip gem documentation instead, invoke
[USERNAME#] gem install passenger --no-ri --no-rdoc
or specify them in your .gemrc file
To install apache2 mod, invoke
[USERNAME#] passenger-install-apache2-module
Hope that helps!

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)

Not able to update ruby version from 1.8.7 to 1.9.2 using rvm

I am new to ruby programming and want to update ruby from 1.8.7 to 1.9.2. I have followed some steps from different sources but not able to get required result
the sequence of steps are given below
#apt-get install ruby-rvm
#rvm remove 1.8.7
#rvm install 1.9.2
#rvm use 1.9.2
Using /usr/share/ruby-rvm/gems/ruby-1.9.2-p290
after that when i fire #ruby -v, then also it gives the result as given below
#ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
Please guide me with specific solution
I am using ubuntu 11.10 beta
you have two installations of rvm, and one of them is broken, please use this answer: Installed Ruby 1.9.3 with RVM but command line doesn't show ruby -v

I can't seem to get rails installed on my Mac (10.6.5). Following Ruby on Rails Tutorial 3

I'm trying to get Rails 3 up and running by following the steps outlined in "Ruby on Rails Tutorial" by Michael Hartl (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book).
The details start in section 1.2.2 (http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:rubygems). Here you go through the following steps:
Installing Git
Installing Ruby (version 1.9.2) using Ruby Version Manager (RVM)
Creating different gemsets for environments using Ruby 1.8.7 and 1.9.2
Installing RubyGems
and finally, installing Rails.
I run the following command [sudo] gem install rails --version 3.0.7
Everything seemed to install correctly (based on no errors). However, when I type "rails -v", rails cannot be found.
I am a Rails newbie. I'm trying to install Rails on a machine running Mac OS X 10.6.7.
Thanks.
If you are using RVM you probably don't want to use sudo when installing gems. If you have Git installed only steps needed to get Rails are:
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.zshrc
# Reload your shell now (open a new terminal for example)
rvm install 1.9.2
rvm 1.9.2 --default
gem install rails --version 3.0.7
hash -r
This skips the gemsets part (you don't need it if you are just starting learning Rails) and assumes that you use Zsh (I think it's Mac OS X default, if you use Bash then you have to alter .bashrc, not .zshrc).
If you want to remove your previous installation and start over use rvm implode.