I intend to install ruby by rvm to my Macbook Pro, with the command tutorial:
$ rvm requirements
$ rvm install 2.3.0
$ rvm use 2.3.0 --default
But you know the 2.3.0 maybe not the newest version, because the tutorial is long time ago.
So, how can I get the lastest version of ruby in command?
rvm get head # update list of known rubies. Necessary if your local list is out of date.
rvm install ruby --latest # install the latest ruby
The latest ruby version (at time of writing) is 2.4.0
you can run rvm list known to see all options, but 2.3 is pretty new and will be a good choice.
Related
I"m using Ubuntu and RVM. I've run the command
rvm use 2.1.2
Running
ruby -v
gives me the 2.1.2 version.
When I start rails I get the following error
Your Ruby version is 2.3.1, but your Gemfile specified 2.1.2
But RVM doesn't even have 2.3.1 installed.
You may have apt installed ruby. For example, when I run apt show ruby, on my system, I get this
$ apt show ruby
Package: ruby
Version: 1:2.3.0+1
Priority: optional
Section: interpreters
Source: ruby-defaults
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
...
Clearly, the ruby version is 2.3.x here. So I suggest you apt remove ruby first. If that doesn't solve the problem, it is possible that there is a problem with your $PATH environment variable.
ruby -v gives you the ruby version installed on your system, not the current ruby version used by RVM.
To see which ruby version is currently used by RVM, use rvm list. Make sure it's using ruby version 2.1.2 by running rvm use ruby-2.1.2
From your question, it seems Rails is using your system ruby instead of RVM ruby.
I am making a script to install the latest stable ruby using rvm. I use:
rvm install ruby --latest
But the problem is, since I do not know which version is going to be installed, I do not know how to use rvm use to set it as the default ruby version.
How could I solve this?
You can do
rvm use ruby --latest --default
I just tried to install Ruby 2.1, and instead got 2.1 Preview 1. This seems crazy to me. 2.1 is out. Why would RVM assume that when I say rvm install ruby-2.1.0 that I really mean rvm install ruby-2.1.0-preview1? Why would it not match the exact version I specified, instead of one which begins with that substring?
Silly clarification question (and I would post it as a comment if I had enough reputation), but have you updated RVM lately?
rvm get stable (or if you want to live on the edge, rvm get head) would, I expect, update the internal list of released ruby versions.
Make sure you are running the latest version. RVM 1.25.8 (or greater) is working as expected.
$ rvm get latest
Downloading https://github.com/wayneeseguin/rvm/archive/1.25.8.tar.gz
and
$ rvm install 2.1
Searching for binary rubies, this might take some time.
...
ruby-2.1.0 - #downloading ruby-2.1.0, this may take a while depending on your connection...
and
$ rvm use 2.1
Using /Users/weppos/.rvm/gems/ruby-2.1.0
$ ruby --version
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]
So far I only know how to do commands like
rvm 2.0.0
Fortunately Google tells me
The current stable version is 2.0.0-p247.
But shouldn't I be able to use rvm to do that step for me? I can't figure out how to just tell rvm to install the latest version of ruby, without manually specifying it.
it is enough to:
rvm get stable
rvm use ruby --install --default
it will update rvm, check for latest ruby - install it if missing - and set as default
I don't know of a way to have rvm just install the latest version automatically, but here's three simple commands using just rvm:
rvm reload
rvm list known # This will show all the available versions, including the latest
rvm install <latest_version> # Replace <latest_version> with the latest shown by the last command
rvm install ruby-head should install the last known version.
I installed RVM with a few versions of Ruby-interpreters some time ago.
How I can to update it, because new versions are already released?
I found only one way: rvm install 1.9.2-rc1 && rvm remove 1.9.2-preview1, but my gems are lost.
Can I update branches time to time? I haven't found any tips in the documentation.
Use the rvm upgrade 1.9.2-preview1 1.9.2-rc1 command or watch this screencast
[Edit: rvm has a new command to upgrade-- you likely want to use the answer by andy318]
AFAIK, there is no automatic way to do this at the moment, but something like this enables you to keep your gems:
rvm use 1.9.2-preview1
rvm gemset export
rvm install 1.9.2-rc1
rvm use 1.9.2-rc1
rvm gemset import
rvm remove 1.9.2-preview1
Now, for automating updates, you would have to detect version changes, that is easy, as you can simply use the return value of rvm use 1.9.2. Finding out what the new version is (1.9.2-rc1) is unnecessary, as it is aliased as 1.9.2. The trick is to find the latest installed version of 1.9.2. You could do something like this in a cron job:
# make sure you source rvm first
rvm update --head
rvm reload
if [ ! rvm use 1.9.2 ]; then
for ruby_version in `rvm list strings`; do
# find the latest version of 1.9.2
case $ruby_version in
ruby-1.9.2-*) latest192=$ruby_version;;
esac
done
rvm use $latest192
rvm gemset export 192.gems
rvm install 1.9.2
rvm use 1.9.2
rvm gemset import 192
rvm remove $latest192
fi
Did not try that, but I have similar code in my update script. I also slipped in a gem update and other stuff.
Feel free to visit the #rvm IRC channel on Freenode.
Current rvm version provides an easier way to do this. The 'upgrade' option will migrate gem sets, wrappers and environment files -
$ rvm upgrade 1.9.2-p136 1.9.2-p180
To find out if there is a more recent stable version of a ruby implementation for you to upgrade to, first get the latest version of RVM and then enumerate the known versions of Ruby.
$ rvm get stable
$ rvm list known
You can compare this the ruby versions installed on your system
$ rvm list rubies
you can install latest rvm and ruby by :
$ \curl -L https://get.rvm.io | bash -s stable --ruby
and check all the ruby version with stability
$ rvm list known
can also check details here : http://www.ruby-lang.org/en/downloads/
$ rvm install ruby 2.0.0-p247
Use when you want to download specific version or know this is stable.
There's a fantastic RVM GUI called JewelryBox that I use to manage my Ruby versions
http://jewelrybox.unfiniti.com
I think that is:
rvm all do gemset update