rvm resetting the default - ruby

These are the rubies I have installed with RVM
rvm rubies
ruby-1.8.7-head [ x86_64 ]
ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.3-rc1 [ x86_64 ]
I have a lot of gemsets for 1.9.2
gemsets for ruby-1.9.2-p290 (found in /Users/mm/.rvm/gems/ruby-1.9.2-p290)
19332
309
clone
devise
devise311
enki
global
rails3
rails301
rails303
rails304
rails310
rails313
rails32
rails323
rails3tutorial
railsValim
However, when I tried to use one of them, it said it didn't exist
rvm use 1.9.2#rails304
ERROR: Gemset 'rails304' does not exist, rvm gemset create 'rails304' first.
WARN: Gemset doesn't exist, proceeding with default gemset
WARN: ruby ruby-1.9.2-use1.9.2 is not installed.
To install do: 'rvm install ruby-1.9.2-use1.9.2'
Please notice the reference to the version of Ruby in the last line
To install do: 'rvm install ruby-1.9.2-use1.9.2'
This is different than the ruby listed above
ruby-1.9.2-p290 [ x86_64 ]
I don't know where the Ruby with 'use1.9.2' at the end came from. Maybe I screwed up somehow by trying to do something like rvm use 1.9.2 so the word 'use' got stuck together with 1.9.2., so I tried to set the other rvm ruby (p290) as the default
rvm use ruby-1.9.2-p290 --default
Using /Users/me/.rvm/gems/ruby-1.9.2-p290
but when I did that and tried to use one of its gemsets, it said it didn't exist
rvm use 1.9.2#rails304
ERROR: Gemset 'rails304' does not exist, rvm gemset create 'rails304' first.
WARN: Gemset doesn't exist, proceeding with default gemset
WARN: ruby ruby-1.9.2-use1.9.2 is not installed.
To install do: 'rvm install ruby-1.9.2-use1.9.2'
and again, it had reference to this other ruby version 'ruby-1.9.2-use.1.9.2' with that funny 'use.1.9.2' on the end.
I don't know if this is my human error, or something that's resulting from my recent installation of Mountain Lion, which caused some other system changes on my computer.
How would I go about getting 'ruby-1.9.2-use.1.9.2' off my system and using the ruby 1.9.2 listed when I do the command rvm rubies
ruby-1.8.7-head [ x86_64 ]
ruby-1.9.2-p290 [ x86_64 ]
ruby-1.9.3-rc1 [ x86_64 ]

i don't know why synonym "rvm use 1.9.2" stop working and shows such a strange behavior but
assuming using the exact name of rubie work, you can try to specify gemset like this
rvm use ruby-1.9.2-p290#rails304
or to setup as default
rvm use ruby-1.9.2-p290#rails304 --default

Here's some information for understanding the behavior of rvm use
When you run rvm list known it will list rubies in the following format:
[ruby-]1.9.2[-p320]
[ruby-]1.9.3-p125
[ruby-]1.9.3-p194
[ruby-]1.9.3-p286
[ruby-]1.9.3-p327
[ruby-]1.9.3[-p362]
The parts contained in [] are optional to type in. Therefore, doing rvm use 1.9.3 would attempt to use 1.9.3-p362 as it is considered the best 1.9.3 version to use. If you don't have it installed, it will ask you to install it first. That means, when you installed ruby-1.9.2 it probably installed p290 as it was the latest version and that is no longer the case after upgrading RVM to a newer version. Therefore, to use your gemsets for the version you have installed, you need to do rvm use ruby-1.9.2-p290#GEMSET.

Related

How to install ruby 1.8.7 on ubuntu 12.04 with rvm?

I'm working with a legacy rails system. I need a copy of ruby 1.8.7
I've just been given a new computer at work (finally) and it has ubuntu 12.04
Unfortunately I've just discovered that the rvm-rubies available for my system do not contain 1.8.7 (see list below)
How can I install ruby 1.8.7?
Is there another source that I can point to that will work?
Please note: I did not use apt-get to install rvm, that is not the problem
This is the list of available rubies:
# Rubies available for 'ubuntu/12.04/x86_64':
ruby-1.9.3-p194
ruby-1.9.3-p286
ruby-1.9.3-p327
ruby-1.9.3-p362
ruby-1.9.3-p374
ruby-1.9.3-p392
ruby-1.9.3-p429
ruby-1.9.3-p448
ruby-2.0.0-p0
ruby-2.0.0-p195
ruby-2.0.0-p247
Edit:
Just so you know, here's the output of some of the simpler rvm commands:
triton:[~]% rvm list
rvm rubies
# No rvm rubies installed yet. Try 'rvm help install'.
And rvm install gives this message (which make sit clear there is no version of 1.8.7 in the standard repository).
triton:[~]% rvm install 1.8.7
Searching for binary rubies, this might take some time.
No binary rubies available for: ubuntu/12.04/x86_64/ruby-1.8.7-p374.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
You requested building with 'gcc-4.4' but it is not in your path.
From the documentation:
To install a specific tagged version of ruby from the repository we
specify -t(tag name).
It then goes on to talk about branches...
Repository Branches (MRI)
To install a specific branch version of ruby from the repository we specify --branch (branch name). Named rubies can help avoid clashes.
$ rvm install ruby-head -n zombie --branch ruby_1_8 && rvm ruby-head-zombie
$ ruby -v
ruby 1.8.8dev (2012-05-21) [i386-darwin10.8.0]
$ rvm install ruby-head -n newborn && rvm ruby-head-newborn
$ ruby -v
ruby 2.0.0dev (2012-06-03 trunk 35876) [x86_64-darwin10.8.0]
You'll find a list of all valid branches in the ruby repository: http://svn.ruby-lang.org/repos/ruby/branches/
You have access to much more than what is shown.
ruby_1_3/
ruby_1_4/
ruby_1_6/
ruby_1_8/
ruby_1_8_5/
ruby_1_8_6/
ruby_1_8_7/
ruby_1_9_1/
ruby_1_9_2/
ruby_1_9_3/
ruby_2_0_0/
More hints on the RVM official website
Also, for additional help, the IRC Chat room on freenode.net is awesome!
what you have presented is output from rvm list remote - which list binary (already compiled) rubies for your system, to see more possible choices of version run rvm list which will include 1.8.7:
# MRI Rubies
[ruby-]1.8.6[-p420]
[ruby-]1.8.7[-p374]
[ruby-]1.9.1[-p431]
[ruby-]1.9.2[-p320]
[ruby-]1.9.3[-p448]
[ruby-]2.0.0-p195
[ruby-]2.0.0[-p247]
[ruby-]2.0.0-head
ruby-head
and it continues with number of other ruby distributions.
If not sure you can always just run:
rvm install 1.8.7
RVM does all kind of detections and will most likely know what to do with specified version.
For future reference: I figured it out.
The important clue was in the last line of the result for rvm install:
You requested building with 'gcc-4.4' but it is not in your path.
I had gcc version 4.6 but my .zshrc (copied from my previous computer) was pointing at this older version.
Because of this, rvm thought I didn't have a c-compiler. Which means that rvm wasn't able to install any rubies from source - only pre-compiled rubies - which means it was restricted to only those already pre-compiled for my platform (ie 64-bit ubuntu 12.04)
When I fixed the gcc line in my .zshrc - rvm was able to figure out how to install+compile source-code rubies - including v1.8.7

ruby 1.8.7 & ruby 2 without rmv, failed instalation

I installed ruby 2.0 (from sources) in a centos that already had ruby 1.8.7.
I did not know that there was a previous installation.
I also noticed that had installed RVM. Now it doesn't work.
The RVM output
$ /usr/local/rvm/bin/rvm list
$ rvm rubies
No rvm rubies installed yet. Try 'rvm help install'.
From what I understand, RVM does not know there is already a installed version of Ruby.
Is possible uninstall all versions and reinstall ruby with RVM?
RVM allows "mounting" system rubies:
rvm mount /path/to/ruby
Or assuming all rubies are added to PATH
rvm automount
RVM will find any ruby binary available on PATH and will add it to rvm list
RVM does not care for rubies installed at the system level. It installs rubies to RVMs own folder inside of the users home directory. You should just install the desired ruby version using RVM. Since the RVM rubies should have precedence over the system-installed ruby, that should work out just fine.

Can't find Ruby 1.9.2 after installing RVM

I'm on Linux Ubuntu 12.04, and I first installed Ruby 1.9.2.
After I tried installing rvm to use Octopress, ruby --version in bash results in ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
How can I use RVM with ruby 1.9.2?
I don't really understand what RVM is all about...
The 1.9.2 version you installed first is not accessible from rvm.
While working with rvm, only the list of rubies installed through rvm is served. The previously installed versions of ruby - while still present in the filesystem - are not included.
With the steps you have done so far, you have a 1.9.2 version installed in one location, and a 1.8.7 version installed as part of rvm.
Install 1.9,2 version by running the rvm install 1.9.2 command. After that, when you run the rvm list command, you should see an output similar to the following:
$ rvm list
rvm rubies
ruby-1.8.7-p358 [ i686 ]
=* ruby-1.9.2-p320 [ x86_64 ]
# => - current
# =* - current && default
# * - default
You can switch between different versions of ruby managed by rvm with the rvm use 1.8.7 / rvm use 1.9.2 commands.
Here's a short blogpost with a good intro to rvm: Get started right with RVM
RVM is a version manager which enables you to decide which of multiple installed Ruby versions you want to use in your current shell session. RVM does this by providing a shell function named rvm which can be used to switch between versions in the current session. This changes environment variables, especially the GEM_HOME and PATH, to match the currently selected Ruby installation.
Every installed Ruby version can be selected by a specific identifier string. If you had a system-wide Ruby installation already before you installed RVM, that one should be referenced by the string system. The newly installed version in your case should be called 1.9.2.
To make RVM work as intended, it is necessary to load the rvm shell function into your shell. How to do this is described in the RVM Installation Documentation in section 2 - "Load RVM into your shell sessions as a function".
You can see if the shell function is correctly loaded when the command type rvm | head -n1 responds with:
rvm is a shell function
If not correctly loaded it will tell you something like this:
rvm is /home/someone/.rvm/bin/rvm
If you finally have it working you can switch your active Ruby version with commands like rvm 1.9.2 or rvm system. You can get a list of all Ruby versions and their identifier strings recognized by RVM by the command rvm list.
You can also specify which Ruby version shall be enabled in all new shell sessions from the beginning by issuing the following command once:
rvm --default 1.9.2
Perhaps you have not yet switched to the ruby version with:
rvm use 1.9.2 (assuming you did rvm install 1.9.2)
for a more general explanation I gave an answer here which might help.

RVM on Ubuntu Troubles

I've run into a lot of issues whilst attempting to install RVM on Ubuntu 9.10. Here's the steps I've tried doing:
install ruby (via ruby site, no package manager)
download rvm
install rvm (make edit to .bashrc)
use rvm to install ruby version & gems
Is there any crucial step that I seem to be missing?
Be sure to have selected an installed ruby (the --default portion tells rvm you want this ruby to be your default ruby version). Something like:
rvm --default use 1.9.2
Also this command will tell you which ruby is currently selected:
rvm list
And hopefully you'll see something like:
rvm rubies
ruby-1.9.2-p0 [ x86_64 ]
=> ruby-1.8.7-p302 [ x86_64 ]
At this point, you'll be able to install gems and hopefully have a successful rvm install and working environment.
I've had issues in the past where I didn't have an rvm ruby selected and was still working with my distribution's ruby and gems and got mixed up easily. Make sure you're ruby and gem commands are working out of your ~/.rvm folder whith the following commands:
which ruby
which gem
Good luck!
What are the issues you're running into? Sometimes I forget to switch into the correct rvm environment (e.g. rvm ree), so it helps to place a .rvmrc file in project directories.
I would start off by removing ubuntu's ruby installation so that you don't have to worry about conflicts (although rvm will setup your PATH correctly). Following the instructions at RVM, run the following command to install rvm,
bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )
and then install system dependencies as listed in rvm notes. and then install the specific ruby version you want (e.g. rvm install ree or rvm install 1.9.1)
Important : for a good installation try this :
type rvm | head -n1
Must return : rvm is a function
else add this line
[[ -s "/usr/local/rvm/scripts/rvm" ]] && . "/usr/local/rvm/scripts/rvm"
in your profile.

How to manage multiple gemsets and ruby versions with RVM?

I am really confused by the explanations given in RVM website. The relation between different ruby interpretors and gemsets are not clear to me. According to me, it is like this -
My Account in my Mac have one rvm
That rvm installs and manages set of different versions of ruby interpretors.
each ruby version has set of gemsets.
Am i getting things clear... Any more amount of explanations are welcome. I am in a position to work on (Ruby 1.8.7 + rails 2.3.8 and its dependencies) and (Ruby 1.9.2 and Rails 3.0 and its dependencies)...
If any one is well versed with handling many ruby versions and gemsets with the help of rvm, please explain to me... thanks for the help
Here is how I like to do it...
Install a ruby with RVM
Switch to/use that ruby
Create a gemset for a project
Switch to/use that gemset
Install gems needed
create an alias that points to my chosen ruby & gemset
switch to/use that new alias (again, associated w/ a project)
Do this as many times necessary for your different projects that you want to keep separate from eachother.
Example:
$ rvm install ruby-1.9.2
...
$ rvm list
rvm rubies
=> ree-1.8.7-head [ i386 ]
ruby-1.9.2-head [ i386 ]
ruby-1.9.2-preview3 [ i386 ]
$ rvm use ruby-1.9.2-preview3
info: Using ruby 1.9.2 preview3
$ rvm gemset create my_project
info: Gemset 'my_project' created.
rvm gemset use my_project
info: Now using gemset 'my_project'
$ gem install httparty
When you HTTParty, you must party hard!
Successfully installed crack-0.1.8
Successfully installed httparty-0.6.1
2 gems installed
$ rvm alias create my_project ruby-1.9.2-preview3#my_project
info: Creating alias my_project for ruby-1.9.2-preview3#my_project.
info: Recording alias my_project for ruby-1.9.2-preview3#my_project.
$ rvm use my_project
info: Using ruby 1.9.2 preview3 with gemset my_project
$ ....
Now I have an entire environment dedicated to a particular project. This is great because I can experiment with all sorts of different gems/versions without worrying about stomping all over other projects that have very specific requirements.
Good luck!
To add onto Brian's answer above, you can also use .rvmrc files to dynamically switch gemsets when entering new project directories.
simply run the following:
rvm rvmrc create ruby-1.8.7-p358#my_project
This will help stop confusion which I had when switching and forgetting to change gemsets
UPDATE
.rvmrc files are in the process of being dropped for the newer .ruby-version file
see discussion here: https://gist.github.com/fnichol/1912050

Resources