Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you install Rails 4.0 in an RVM gemset?

I am trying to install Rails into a new rvm gemset. I tried the following:

rvm gemset create rails-4.0 output: gemset created rails-4.0 

Next I did:

rvm [email protected] 

rvm gemset list:

gemsets for ruby-2.0.0-p0 (found in /Users/me/.rvm/gems/ruby-2.0.0-p0)    (default)    global => rails-4.0 

rails -v

Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails 

Do the rvm commands I listed not install rails 4.0?

like image 746
user1096509 Avatar asked Mar 05 '13 18:03

user1096509


People also ask

What is Gemset in RVM?

If you are using RVM(Ruby Version Manager) then using a gemset for each project is a good idea. A gemset is just a container you can use to keep gems separate from each other. Creating a gemset per project allows you to change gems (and gem versions) for one project without breaking all your other projects.


1 Answers

This command:

rvm gemset create rails-4.0 

is creating basically a directory structure to hold the gems. You could have just as easily called it something other than "rails-4.0" like "foo" and it would be the same behavior.

This command:

rvm [email protected] 

Switches to Ruby 2.0.0 and tells it to use the new gemset named rails-4.0. Again, that could be "foo" or whatever you called it.

Now, to get Rails 4.0.x, you'd do:

gem install rails --version=4.0 

As Barrett pointed out earlier, to get a pre/beta/rc release, you can specify the whole version string, e.g. gem install rails --version=4.0.0.rc2.

Don't sudo, because you shouldn't sudo with rvm, even though it tells you to. With the "system ruby" (ruby not installed by rvm), it may be installed as root, so you need superuser (su) access (superuser do or "sudo") to do that. But, rvm has you install things as the current user, therefore you don't need to sudo.

like image 90
Gary S. Weaver Avatar answered Oct 21 '22 13:10

Gary S. Weaver