I've just started learning RoR and I've come across a problem.
ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
But when I try to install version 1.9.3 this is what happens:
rvm install 1.9.3
Already installed ruby-1.9.3-p484.
To reinstall use:
rvm reinstall ruby-1.9.3-p484
Sorry if it's a noob question, I've just started learning.
I'm running Elementary OS (Ubuntu based distro)
Make ruby 1.9.3 default, or even better use ruby 2.1 if you are just starting with Rails 4.2
rvm --default use 1.9.3
or better
rvm install 2.1
rvm --default use 2.1
Ruby 1.9.3 is already installed. To use it, write
rvm use 1.9.3
To make it the default version, use
rvm --default use 1.9.3
And to get all your ruby versions installed, use
rvm list
Since RVM performs non-standard installs, the new version won't be automatically chosen.
You have to explicitely "enter" the new Ruby environment with
rvm use 1.9.3
Related
I'm sure this is a very common question, but I can't make it work even after following several tutorials about it.
I'm using Ubuntu 16.04 lts and I just installed Ruby on Rails with Rbenv, but then, after running rails server I get the Your Ruby version is 2.3.1, but your Gemfile specified 2.1.4 message.
How can I make it work?
As Sergio pointed you, you need to update your Ruby or your Gemfile.
In my experience, there are not a lot of major changes between Ruby 2.1 and 2.3, so I suggest updating your Gemfile.
If you don't want to do that, then here is how to install Ruby 2.1.4:
rbenv install 2.1.4
Also, be sure to set the version:
rbenv local 2.1.4
ruby -v
Should return 2.1.4
rbenv reference
rvm --default use 2.1.4
rvm use 2.1.4#"folder name" --create
I received a new Macbook Pro for work and started to setup my local machine for development. I installed RVM, then proceeded to install different ruby versions: 2.1, 2.0, 1.9, and 1.8.7. I need 1.8.7 because I will be working on an older site running this legacy version of ruby.
Anyway, when I type: rvm install 1.8.7, rvm installs both 1.8.7-p374 and 1.8.7-head. These installs were successful. When I type: rvm use 1.8.7, it defaults to the ruby-1.8.7-head version.
Why does rvm insist on installing both versions of ruby 1.8.7?
Please specify explicit full version of ruby to install:
rvm install 1.8.7-p374
In case of version ruby-2.0, you get the only version because there is the only one for the specified.
Hi I am beginner to ruby on rails. I have following this on my machine
nilkash#nilkash:~$ ruby -v
ruby 1.9.3p392 (2013-02-22 revision 39386) [i686-linux]
nilkash#nilkash:~$ rails -v
Rails 3.2.3
nilkash#nilkash:~$ rvm -v
rvm 1.19.6 (master) by Wayne E. Seguin <wayneeseguin#gmail.com>, Michal Papis <mpapis#gmail.com> [https://rvm.io/]
nilkash#nilkash:~$ rvm list
rvm rubies
=* ruby-1.9.3-p392 [ i686 ]
# => - current
# =* - current && default
# * - default
nilkash#nilkash:~$ rvm gemset list
gemsets for ruby-1.9.3-p392 (found in /home/nilkash/.rvm/gems/ruby-1.9.3-p392)
(default)
global
latest_rails_stable
=> rails3tutorial2ndEd
I also install rails version 4.0.0. But I don't know how to use different versions of rails. when i create new project it shows rails version 3.x. I want to upgrade it to version 4. How to check list of all installed rails and how to use latest one. Need Help. Thank you.
I also install rails version 4.0.0. But I don't know how to use different versions of rails. when i create new project it shows rails version 3.x. I want to upgrade it to version 4. How to check list of all installed rails and how to use latest one. Need Help. Thank you.
this is because you're still using the current gemset rails3tutorial2ndEd
You need to create a different gemset:
rvm gemset create <new_gemset_name>
then use it:
rvm gemset use <new_gemset_name>
and finally install a new rails version:
gem install rails -v <version_number>
only after doing these things will you be able to make a new project with a different rails version.
If you want to only do a quick command in different rails version you can do:
$ rails _4.0.1_ new MyRailsApp
That way you don't have some gems installed twice as you do when you use gem sets. Bundler should handle the rest so you should only need one gemset.
In your Gemfile, you will see the line gem 'rails', '3.2.3' or which version you are using. You can modify it and execute bundle again.
You can execute gem list --local on the console to check all versions of your gems installed.
In my opinion, you would better to use rvmrc to define different gemset in the different projects, it reduces chaos. see details: https://rvm.io/workflow/projects
you can create gemset with rvm gemset create <gemset name> then switch to it rvm use <ruby version>#<gemset name> and install another version of rails in this gemset
You can have a different ruby version for different gems.
I am going to give an example way to manage for ruby 2.1.10 with rails 4.1 and ruby 2.4.1 with rails 5.1.
This is a quote from rvm official website take a look.
RVM gives you compartmentalized independent ruby setups. This means
that ruby, gems and irb are all separate and self-contained - from the
system, and from each other.
You may even have separate named gemsets.
I am supposing you had already installed a different version of ruby. To list user rvm list. It will list installed ruby and currently which one be using.
if you have not installed any no problem follow this official rvm documentation.
Install 2.1.10 with rails 4.1.0
rvm use 2.1.10
gem install rails -v 4.1.0
rvm use 2.1.10#rails410 --create
rvm 2.1.10
ready and good to go for ruby 2.1.10 with rails 4.1.0
Install 2.4.1 with rails 5.1.0
rvm use 2.4.1
gem install rails -v 5.1.0
rvm use 2.4.1#rails510 --create
rvm 2.4.1
ready and good to go ruby 2.4.1 with rails 5.1.0
You have set 2 gemsets above. Just use rvm 2.1.10 for ruby 2.1.10 and rails 4.1 and rvm 2.4.1 for ruby 2.4.1 and rails 5.1.0.
Apologies in advance if this is a too nubs problem.
One friend got Beginning Rails 3 and we started playing Ruby using it (as .net developers!). I have installed Ubuntu 10.10 on VMWare Player - which apparently already had Ruby 1.9.2. Based on instructions in the book (with some quirks for total linux nubs) we managed to install Ruby 1.9.1 (ruby --version -> ruby 1.9.1p376 (2009-12-07 revision 26041) [i686-linux]).
But Rails (latest version - 3.0.2 I think) insist that Ruby 1.9.2 is better for our health!
So: How to update Ruby on Ubuntu 10.10? I want just this one ruby be there.
I recommend Ruby Version Manager.
Install (yes, it takes a leap of faith):
$ curl https://get.rvm.io | bash
then
$ rvm install 1.9.2
$ rvm use 1.9.2
The recommended way to manage Ruby versions is through RVM: http://rvm.io/
Rails is right about the Ruby versions, btw.
I have a Ubuntu rails enviroment for playing around with ROR.
Right now I am running Rails 2.3.8.
I want to look into rails 3. Is it possible to run both dev enviroments side-by-side?
If not, how do I clean up my rails 2.x system to install rails 3?
Or do I need to setup a whole new Ubuntu machine?
Any help, links... pointers would be great!
I would highly recommend Ruby Version Manager (rvm) - see this railscast for more information. This allows you to easily manage different versions of Ruby on the same machine. I believe this should also enable you to keep the different versions of Rails separate from each other, and allow you to switch between them easily - see this example from http://rvm.beginrescueend.com/gemsets/basics/ :
rvm 1.9.2-head
gem install rails -v 2.3.3
rvm gemset create rails222 rails126
Gemset 'rails222' created.
Gemset 'rails126' created.
rvm 1.9.2-head#rails222
gem install rails -v 2.2.2
rvm 1.9.2-head#rails126
gem install rails -v 1.2.6
Hope that helps!
For Windows users:
(I realize the asker uses Ubuntu, but this came up in the SERPs when I had a Windows-related question.)
You'll find that rvm isn't an option. You can use pik, however:
-- install the gem
> gem install pik
-- run 'install' command to add the utility to your system
> pik_install [some dir in your PATH variable]
-- tell pik where your Ruby versions are
> pik add C:\Ruby187\bin
> pik add C:\Ruby193\bin
-- see which versions pik has under control and which one is actively being used
> pik list
* 187: ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
193: ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
-- tell pik to use a different version
> pik use 193
> pik list
187: ruby 1.8.7 (2011-06-30 patchlevel 352) [i386-mingw32]
* 193: ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
-- confirm the change worked:
> ruby -v && rails -v
ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
Rails 3.2.3