https://wiki.archlinux.org/api.php?action=feedcontributions&user=Trutch&feedformat=atomArchWiki - User contributions [en]2024-03-19T13:46:09ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=RVM&diff=129558RVM2011-02-01T13:07:32Z<p>Trutch: </p>
<hr />
<div>[http://rvm.beginrescueend.com/ RVM] (Ruby Version Manager) is a command line tool which allows us to easily install, manage and work with multiple [[Ruby]] environments from interpreters to sets of gems.<br />
<br />
{{Note|These instructions bypass pacman.}}<br />
<br />
=== Installing RVM ===<br />
<br />
The install process is very easy, and is the very same for any distro, including ArchLinux. You have two choices, one system-wide, another as a user. The first is for production servers, or if your are alone on your machine. You'll need root privileges. The second is the recommended for multiple users on the same machine (like a development test box).<br />
<br />
As an observation, installing RVM with gem is not recommended anymore. This article uses the [http://rvm.beginrescueend.com/rvm/install/ recommended documentation] with minor tweaks to make work on ArchLinux.<br />
<br />
==== Pre-requisites ====<br />
<br />
$ pacman -S git curl<br />
<br />
==== System-wide installation ====<br />
<br />
First we will use the script that rvm docs recommends to install:<br />
<br />
$ bash < <( curl -L http://github.com/wayneeseguin/rvm/raw/master/contrib/install-system-wide )<br />
<br />
'''If''' you want to check the script before:<br />
<br />
$ curl -L http://bit.ly/rvm-install-system-wide > rvm-install-system-wide<br />
<br />
Inspect the file here, then:<br />
<br />
$ bash < ./rvm-install-system-wide<br />
<br />
After the script process, add this to the last line of /etc/bash.bashrc<br />
<br />
$ <nowiki>[[ -s '/usr/local/lib/rvm' ]]</nowiki> && source '/usr/local/lib/rvm'<br />
<br />
Now go to post-installation procedures.<br />
<br />
==== User installation ====<br />
<br />
User-wide installation have a similar procedure to the system-wide install:<br />
<br />
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )<br />
<br />
Then add to your ~/.bash_profile or ~/.bashrc:<br />
<br />
$ <nowiki>[[ -s "$HOME/.rvm/scripts/rvm" ]]</nowiki> && source "$HOME/.rvm/scripts/rvm"<br />
<br />
==== Post installation ====<br />
<br />
After the installation, check with this command:<br />
<br />
$ type rvm | head -n1<br />
<br />
The response should be:<br />
<br />
$ rvm is a function<br />
<br />
If you receive rvm: not found, you may need to source /etc/bash.bashrc:<br />
<br />
$ . /etc/bash.bashrc<br />
<br />
Check if the rvm function is working:<br />
<br />
$ rvm notes<br />
<br />
=== Using RVM ===<br />
<br />
Here's some RVM usage examples, for general usage no more is needed.<br />
<br />
==== Installing an environment ====<br />
<br />
To install a Ruby environment, run:<br />
<br />
$ rvm install <environment/ruby version><br />
<br />
For example, to install Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm install 1.8.7<br />
<br />
This should download, configure and install Ruby 1.8.7. Make sure, you have gcc or another fitting compiler installed.<br />
<br />
==== Listing Ruby Environments ====<br />
<br />
To see all available Ruby environments, run the following command:<br />
<br />
$ rvm list<br />
<br />
This would generate a list like so:<br />
<br />
~> rvm list<br />
<br />
rvm Rubies<br />
jruby-1.5.0 [ [i386-java] ]<br />
=> ruby-1.8.7-p249 [ i386 ]<br />
ruby-1.9.2-head [ i386 ]<br />
System Ruby<br />
system [ i386 ]<br />
<br />
The ASCII arrow indicates which environment is currently enabled. In this case, it is Ruby 1.8.7. This could be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== Switching Environment ====<br />
<br />
To switch from one environment, to another simply run:<br />
<br />
$ rvm <version/environment><br />
<br />
For example to switch to Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm 1.8.7<br />
<br />
It can be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== RVM update ====<br />
<br />
Simply use:<br />
<br />
$ rvm update<br />
<br />
==== Revert the default ruby to system ruby ====<br />
<br />
$ rvm system<br />
<br />
And check if the version complies with your system installed package:<br />
<br />
$ ruby -v<br />
$ pacman -Q ruby<br />
$ which ruby<br />
<br />
"which ruby" must be pointing to /usr/bin/ruby<br />
<br />
=== Troubleshooting ===<br />
<br />
You'll need to take care with rvm installations, since ArchLinux is very well updated, and some earlier ruby's patchlevels don't like it. RVM many times don't choose the latest patchlevel version to install, and you'll need to check manually on the [http://www.ruby-lang.org/en/news/ ruby website], and force RVM to install it.<br />
<br />
==== Ruby 1.8.x won't compile with RVM ====<br />
<br />
This is a known issue on Arch Linux, and is caused by a problem with openssl. Arch uses openssl 1.0, lower patchlevels of 1.8.7 assumes 0.9. <br />
<br />
You can use newer patchlevels, like p299 '''or newer''' with:<br />
<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7-p299<br />
<br />
Another approach is to install local openssl via RVM:<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7 -C --with-openssl-dir=$HOME/.rvm/usr<br />
<br />
==== Ruby 1.9.x won't compile with RVM ====<br />
<br />
Like with 1.8.x, earlier patchlevels don't like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.9.1<br />
$ rvm install 1.9.1 -C --with-openssl-dir=/usr/local/rvm/usr</div>Trutchhttps://wiki.archlinux.org/index.php?title=RVM&diff=129557RVM2011-02-01T13:06:32Z<p>Trutch: </p>
<hr />
<div>[http://rvm.beginrescueend.com/ RVM] (Ruby Version Manager) is a command line tool which allows us to easily install, manage and work with multiple [[Ruby]] environments from interpreters to sets of gems.<br />
<br />
{{Note|These instructions bypass pacman.}}<br />
<br />
=== Installing RVM ===<br />
<br />
The install process is very easy, and is the very same for any distro, including ArchLinux. You have two choices, one system-wide, another as a user. The first is for production servers, or if your are alone on your machine. You'll need root privileges. The second is the recommended for multiple users on the same machine (like a development test box).<br />
<br />
As an observation, installing RVM with gem is not recommended anymore. This article uses the [http://rvm.beginrescueend.com/rvm/install/ recommended documentation] with minor tweaks to make work on ArchLinux.<br />
<br />
==== Pre-requisites ====<br />
<br />
$ pacman -S git curl<br />
<br />
==== System-wide installation ====<br />
<br />
First we will use the script that rvm docs recommends to install:<br />
<br />
$ bash < <( curl -L http://github.com/wayneeseguin/rvm/raw/master/contrib/install-system-wide )<br />
<br />
'''If''' you want to check the script before:<br />
<br />
$ curl -L http://bit.ly/rvm-install-system-wide > rvm-install-system-wide<br />
<br />
Inspect the file here, then:<br />
<br />
$ bash < ./rvm-install-system-wide<br />
<br />
After the script process, add this to the last line of /etc/bash.bashrc<br />
<br />
$ <nowiki>[[ -s '/usr/local/lib/rvm' ]]</nowiki> && source '/usr/local/lib/rvm'<br />
<br />
Now go to post-installation procedures.<br />
<br />
==== User installation ====<br />
<br />
User-wide installation have a similar procedure to the system-wide install:<br />
<br />
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )<br />
<br />
Then add to your ~/.bash_profile or ~/.bashrc:<br />
<br />
$ <nowiki>[[ -s "$HOME/.rvm/scripts/rvm" ]]</nowiki> && source "$HOME/.rvm/scripts/rvm"<br />
<br />
==== Post installation ====<br />
<br />
After the installation, check with this command:<br />
<br />
$ type rvm | head -n1<br />
<br />
The response should be:<br />
<br />
$ rvm is a function<br />
<br />
If you don't get a response, you may need to source /etc/bash.bashrc:<br />
<br />
$ . /etc/bash.bashrc<br />
<br />
Check if the rvm function is working:<br />
<br />
$ rvm notes<br />
<br />
=== Using RVM ===<br />
<br />
Here's some RVM usage examples, for general usage no more is needed.<br />
<br />
==== Installing an environment ====<br />
<br />
To install a Ruby environment, run:<br />
<br />
$ rvm install <environment/ruby version><br />
<br />
For example, to install Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm install 1.8.7<br />
<br />
This should download, configure and install Ruby 1.8.7. Make sure, you have gcc or another fitting compiler installed.<br />
<br />
==== Listing Ruby Environments ====<br />
<br />
To see all available Ruby environments, run the following command:<br />
<br />
$ rvm list<br />
<br />
This would generate a list like so:<br />
<br />
~> rvm list<br />
<br />
rvm Rubies<br />
jruby-1.5.0 [ [i386-java] ]<br />
=> ruby-1.8.7-p249 [ i386 ]<br />
ruby-1.9.2-head [ i386 ]<br />
System Ruby<br />
system [ i386 ]<br />
<br />
The ASCII arrow indicates which environment is currently enabled. In this case, it is Ruby 1.8.7. This could be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== Switching Environment ====<br />
<br />
To switch from one environment, to another simply run:<br />
<br />
$ rvm <version/environment><br />
<br />
For example to switch to Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm 1.8.7<br />
<br />
It can be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== RVM update ====<br />
<br />
Simply use:<br />
<br />
$ rvm update<br />
<br />
==== Revert the default ruby to system ruby ====<br />
<br />
$ rvm system<br />
<br />
And check if the version complies with your system installed package:<br />
<br />
$ ruby -v<br />
$ pacman -Q ruby<br />
$ which ruby<br />
<br />
"which ruby" must be pointing to /usr/bin/ruby<br />
<br />
=== Troubleshooting ===<br />
<br />
You'll need to take care with rvm installations, since ArchLinux is very well updated, and some earlier ruby's patchlevels don't like it. RVM many times don't choose the latest patchlevel version to install, and you'll need to check manually on the [http://www.ruby-lang.org/en/news/ ruby website], and force RVM to install it.<br />
<br />
==== Ruby 1.8.x won't compile with RVM ====<br />
<br />
This is a known issue on Arch Linux, and is caused by a problem with openssl. Arch uses openssl 1.0, lower patchlevels of 1.8.7 assumes 0.9. <br />
<br />
You can use newer patchlevels, like p299 '''or newer''' with:<br />
<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7-p299<br />
<br />
Another approach is to install local openssl via RVM:<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7 -C --with-openssl-dir=$HOME/.rvm/usr<br />
<br />
==== Ruby 1.9.x won't compile with RVM ====<br />
<br />
Like with 1.8.x, earlier patchlevels don't like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.9.1<br />
$ rvm install 1.9.1 -C --with-openssl-dir=/usr/local/rvm/usr</div>Trutchhttps://wiki.archlinux.org/index.php?title=RVM&diff=129556RVM2011-02-01T13:05:48Z<p>Trutch: </p>
<hr />
<div>[http://rvm.beginrescueend.com/ RVM] (Ruby Version Manager) is a command line tool which allows us to easily install, manage and work with multiple [[Ruby]] environments from interpreters to sets of gems.<br />
<br />
{{Note|These instructions bypass pacman.}}<br />
<br />
=== Installing RVM ===<br />
<br />
The install process is very easy, and is the very same for any distro, including ArchLinux. You have two choices, one system-wide, another as a user. The first is for production servers, or if your are alone on your machine. You'll need root privileges. The second is the recommended for multiple users on the same machine (like a development test box).<br />
<br />
As an observation, installing RVM with gem is not recommended anymore. This article uses the [http://rvm.beginrescueend.com/rvm/install/ recommended documentation] with minor tweaks to make work on ArchLinux.<br />
<br />
==== Pre-requisites ====<br />
<br />
$ pacman -S git curl<br />
<br />
==== System-wide installation ====<br />
<br />
First we will use the script that rvm docs recommends to install:<br />
<br />
$ bash < <( curl -L http://github.com/wayneeseguin/rvm/raw/master/contrib/install-system-wide )<br />
<br />
'''If''' you want to check the script before:<br />
<br />
$ curl -L http://bit.ly/rvm-install-system-wide > rvm-install-system-wide<br />
<br />
Inspect the file here, then:<br />
<br />
$ bash < ./rvm-install-system-wide<br />
<br />
After the script process, add this to the last line of /etc/bash.bashrc<br />
<br />
$ <nowiki>[[ -s '/usr/local/lib/rvm' ]]</nowiki> && source '/usr/local/lib/rvm'<br />
<br />
Now go to post-installation procedures.<br />
<br />
==== User installation ====<br />
<br />
User-wide installation have a similar procedure to the system-wide install:<br />
<br />
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )<br />
<br />
Then add to your ~/.bash_profile or ~/.bashrc:<br />
<br />
$ <nowiki>[[ -s "$HOME/.rvm/scripts/rvm" ]]</nowiki> && source "$HOME/.rvm/scripts/rvm"<br />
<br />
==== Post installation ====<br />
<br />
After the installation, check with this command:<br />
<br />
$ type rvm | head -n1<br />
<br />
You may need to source /etc/bash.bashrc:<br />
<br />
$ . /etc/bash.bashrc<br />
<br />
The response should be:<br />
<br />
$ rvm is a function<br />
<br />
Check if the rvm function is working:<br />
<br />
$ rvm notes<br />
<br />
=== Using RVM ===<br />
<br />
Here's some RVM usage examples, for general usage no more is needed.<br />
<br />
==== Installing an environment ====<br />
<br />
To install a Ruby environment, run:<br />
<br />
$ rvm install <environment/ruby version><br />
<br />
For example, to install Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm install 1.8.7<br />
<br />
This should download, configure and install Ruby 1.8.7. Make sure, you have gcc or another fitting compiler installed.<br />
<br />
==== Listing Ruby Environments ====<br />
<br />
To see all available Ruby environments, run the following command:<br />
<br />
$ rvm list<br />
<br />
This would generate a list like so:<br />
<br />
~> rvm list<br />
<br />
rvm Rubies<br />
jruby-1.5.0 [ [i386-java] ]<br />
=> ruby-1.8.7-p249 [ i386 ]<br />
ruby-1.9.2-head [ i386 ]<br />
System Ruby<br />
system [ i386 ]<br />
<br />
The ASCII arrow indicates which environment is currently enabled. In this case, it is Ruby 1.8.7. This could be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== Switching Environment ====<br />
<br />
To switch from one environment, to another simply run:<br />
<br />
$ rvm <version/environment><br />
<br />
For example to switch to Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm 1.8.7<br />
<br />
It can be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== RVM update ====<br />
<br />
Simply use:<br />
<br />
$ rvm update<br />
<br />
==== Revert the default ruby to system ruby ====<br />
<br />
$ rvm system<br />
<br />
And check if the version complies with your system installed package:<br />
<br />
$ ruby -v<br />
$ pacman -Q ruby<br />
$ which ruby<br />
<br />
"which ruby" must be pointing to /usr/bin/ruby<br />
<br />
=== Troubleshooting ===<br />
<br />
You'll need to take care with rvm installations, since ArchLinux is very well updated, and some earlier ruby's patchlevels don't like it. RVM many times don't choose the latest patchlevel version to install, and you'll need to check manually on the [http://www.ruby-lang.org/en/news/ ruby website], and force RVM to install it.<br />
<br />
==== Ruby 1.8.x won't compile with RVM ====<br />
<br />
This is a known issue on Arch Linux, and is caused by a problem with openssl. Arch uses openssl 1.0, lower patchlevels of 1.8.7 assumes 0.9. <br />
<br />
You can use newer patchlevels, like p299 '''or newer''' with:<br />
<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7-p299<br />
<br />
Another approach is to install local openssl via RVM:<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7 -C --with-openssl-dir=$HOME/.rvm/usr<br />
<br />
==== Ruby 1.9.x won't compile with RVM ====<br />
<br />
Like with 1.8.x, earlier patchlevels don't like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.9.1<br />
$ rvm install 1.9.1 -C --with-openssl-dir=/usr/local/rvm/usr</div>Trutchhttps://wiki.archlinux.org/index.php?title=RVM&diff=129555RVM2011-02-01T13:05:18Z<p>Trutch: </p>
<hr />
<div>[http://rvm.beginrescueend.com/ RVM] (Ruby Version Manager) is a command line tool which allows us to easily install, manage and work with multiple [[Ruby]] environments from interpreters to sets of gems.<br />
<br />
{{Note|These instructions bypass pacman.}}<br />
<br />
=== Installing RVM ===<br />
<br />
The install process is very easy, and is the very same for any distro, including ArchLinux. You have two choices, one system-wide, another as a user. The first is for production servers, or if your are alone on your machine. You'll need root privileges. The second is the recommended for multiple users on the same machine (like a development test box).<br />
<br />
As an observation, installing RVM with gem is not recommended anymore. This article uses the [http://rvm.beginrescueend.com/rvm/install/ recommended documentation] with minor tweaks to make work on ArchLinux.<br />
<br />
==== Pre-requisites ====<br />
<br />
$ pacman -S git curl<br />
<br />
==== System-wide installation ====<br />
<br />
First we will use the script that rvm docs recommends to install:<br />
<br />
$ bash < <( curl -L http://github.com/wayneeseguin/rvm/raw/master/contrib/install-system-wide )<br />
<br />
'''If''' you want to check the script before:<br />
<br />
$ curl -L http://bit.ly/rvm-install-system-wide > rvm-install-system-wide<br />
<br />
Inspect the file here, then:<br />
<br />
$ bash < ./rvm-install-system-wide<br />
<br />
After the script process, add this to the last line of /etc/bash.bashrc<br />
<br />
$ <nowiki>[[ -s '/usr/local/lib/rvm' ]]</nowiki> && source '/usr/local/lib/rvm'<br />
<br />
Now go to post-installation procedures.<br />
<br />
==== User installation ====<br />
<br />
User-wide installation have a similar procedure to the system-wide install:<br />
<br />
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )<br />
<br />
Then add to your ~/.bash_profile or ~/.bashrc:<br />
<br />
$ <nowiki>[[ -s "$HOME/.rvm/scripts/rvm" ]]</nowiki> && source "$HOME/.rvm/scripts/rvm"<br />
<br />
==== Post installation ====<br />
<br />
After the installation, check with this command:<br />
<br />
$ type rvm | head -n1<br />
<br />
You may need to source /etc/bash.bashrc:<br />
<br />
$ . /etc/bash.bashrc<br />
<br />
The response should be:<br />
<br />
$ rvm is a function<br />
<br />
Check if the rvm function is working:<br />
<br />
$ rvm notes<br />
<br />
=== Using RVM ===<br />
<br />
Here's some RVM usage examples, for general usage no more is needed.<br />
<br />
==== Installing an environment ====<br />
<br />
To install a Ruby environment, run:<br />
<br />
$ rvm install <environment/ruby version><br />
<br />
For example, to install Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm install 1.8.7<br />
<br />
This should download, configure and install Ruby 1.8.7. Make sure, you have gcc or another fitting compiler installed.<br />
<br />
==== Listing Ruby Environments ====<br />
<br />
To see all available Ruby environments, run the following command:<br />
<br />
$ rvm list<br />
<br />
This would generate a list like so:<br />
<br />
~> rvm list<br />
<br />
rvm Rubies<br />
jruby-1.5.0 [ [i386-java] ]<br />
=> ruby-1.8.7-p249 [ i386 ]<br />
ruby-1.9.2-head [ i386 ]<br />
System Ruby<br />
system [ i386 ]<br />
<br />
The ASCII arrow indicates which environment is currently enabled. In this case, it is Ruby 1.8.7. This could be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== Switching Environment ====<br />
<br />
To switch from one environment, to another simply run:<br />
<br />
$ rvm <version/environment><br />
<br />
For example to switch to Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm 1.8.7<br />
<br />
It can be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== RVM update ====<br />
<br />
Simply use:<br />
<br />
$ rvm update<br />
<br />
==== Revert the default ruby to system ruby ====<br />
<br />
$ rvm system<br />
<br />
And check if the version complies with your system installed package:<br />
<br />
$ ruby -v<br />
$ pacman -Q ruby<br />
$ which ruby<br />
<br />
"which ruby" must be pointing to /usr/bin/ruby<br />
<br />
=== Troubleshooting ===<br />
<br />
You'll need to take care with rvm installations, since ArchLinux is very well updated, and some earlier ruby's patchlevels don't like it. RVM many times don't choose the latest patchlevel version to install, and you'll need to check manually on the [http://www.ruby-lang.org/en/news/ ruby website], and force RVM to install it.<br />
<br />
==== Ruby 1.8.x won't compile with RVM ====<br />
<br />
This is a known issue on Arch Linux, and is caused by a problem with openssl. Arch uses openssl 1.0, lower patchlevels of 1.8.7 assumes 0.9. <br />
<br />
You can use newer patchlevels, like p299 '''or newer''' with:<br />
<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7-p299<br />
<br />
Another approach is to install local openssl via RVM:<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7 -C --with-openssl-dir=$HOME/.rvm/usr<br />
<br />
==== Ruby 1.9.x won't compile with RVM ====<br />
<br />
Like with 1.8.x, earlier patchlevels don't like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.9.1<br />
$ rvm install 1.9.1 -C --with-openssl-dir=/usr/local/rvm/usr</div>Trutchhttps://wiki.archlinux.org/index.php?title=RVM&diff=129554RVM2011-02-01T13:02:56Z<p>Trutch: </p>
<hr />
<div>[http://rvm.beginrescueend.com/ RVM] (Ruby Version Manager) is a command line tool which allows us to easily install, manage and work with multiple [[Ruby]] environments from interpreters to sets of gems.<br />
<br />
{{Note|These instructions bypass pacman.}}<br />
<br />
=== Installing RVM ===<br />
<br />
The install process is very easy, and is the very same for any distro, including ArchLinux. You have two choices, one system-wide, another as a user. The first is for production servers, or if your are alone on your machine. You'll need root privileges. The second is the recommended for multiple users on the same machine (like a development test box).<br />
<br />
As an observation, installing RVM with gem is not recommended anymore. This article uses the [http://rvm.beginrescueend.com/rvm/install/ recommended documentation] with minor tweaks to make work on ArchLinux.<br />
<br />
==== Pre-requisites ====<br />
<br />
$ pacman -S git curl<br />
<br />
==== System-wide installation ====<br />
<br />
First we will use the script that rvm docs recommends to install:<br />
<br />
$ bash < <( curl -L http://github.com/wayneeseguin/rvm/raw/master/contrib/install-system-wide )<br />
<br />
'''If''' you want to check the script before:<br />
<br />
$ curl -L http://bit.ly/rvm-install-system-wide > rvm-install-system-wide<br />
<br />
Inspect the file here, then:<br />
<br />
$ bash < ./rvm-install-system-wide<br />
<br />
After the script process, add this to the last line of /etc/bash.bashrc<br />
<br />
$ <nowiki>[[ -s '/usr/local/lib/rvm' ]]</nowiki> && source '/usr/local/lib/rvm'<br />
<br />
Now go to [[#Post Installation|post-installation]] procedures.<br />
<br />
==== User installation ====<br />
<br />
User-wide installation have a similar procedure to the system-wide install:<br />
<br />
$ bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-head )<br />
<br />
Then add to your ~/.bash_profile or ~/.bashrc:<br />
<br />
$ <nowiki>[[ -s "$HOME/.rvm/scripts/rvm" ]]</nowiki> && source "$HOME/.rvm/scripts/rvm"<br />
<br />
==== Post installation ====<br />
<br />
After the installation, check with this command:<br />
<br />
$ type rvm | head -n1<br />
<br />
The response should be:<br />
<br />
$ rvm is a function<br />
<br />
Check if the rvm function is working:<br />
<br />
$ rvm notes<br />
<br />
=== Using RVM ===<br />
<br />
Here's some RVM usage examples, for general usage no more is needed.<br />
<br />
==== Installing an environment ====<br />
<br />
To install a Ruby environment, run:<br />
<br />
$ rvm install <environment/ruby version><br />
<br />
For example, to install Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm install 1.8.7<br />
<br />
This should download, configure and install Ruby 1.8.7. Make sure, you have gcc or another fitting compiler installed.<br />
<br />
==== Listing Ruby Environments ====<br />
<br />
To see all available Ruby environments, run the following command:<br />
<br />
$ rvm list<br />
<br />
This would generate a list like so:<br />
<br />
~> rvm list<br />
<br />
rvm Rubies<br />
jruby-1.5.0 [ [i386-java] ]<br />
=> ruby-1.8.7-p249 [ i386 ]<br />
ruby-1.9.2-head [ i386 ]<br />
System Ruby<br />
system [ i386 ]<br />
<br />
The ASCII arrow indicates which environment is currently enabled. In this case, it is Ruby 1.8.7. This could be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== Switching Environment ====<br />
<br />
To switch from one environment, to another simply run:<br />
<br />
$ rvm <version/environment><br />
<br />
For example to switch to Ruby 1.8.7 one would run the following command:<br />
<br />
$ rvm 1.8.7<br />
<br />
It can be confirmed by running:<br />
<br />
$ ruby --version<br />
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-linux]<br />
<br />
==== RVM update ====<br />
<br />
Simply use:<br />
<br />
$ rvm update<br />
<br />
==== Revert the default ruby to system ruby ====<br />
<br />
$ rvm system<br />
<br />
And check if the version complies with your system installed package:<br />
<br />
$ ruby -v<br />
$ pacman -Q ruby<br />
$ which ruby<br />
<br />
"which ruby" must be pointing to /usr/bin/ruby<br />
<br />
=== Troubleshooting ===<br />
<br />
You'll need to take care with rvm installations, since ArchLinux is very well updated, and some earlier ruby's patchlevels don't like it. RVM many times don't choose the latest patchlevel version to install, and you'll need to check manually on the [http://www.ruby-lang.org/en/news/ ruby website], and force RVM to install it.<br />
<br />
==== Ruby 1.8.x won't compile with RVM ====<br />
<br />
This is a known issue on Arch Linux, and is caused by a problem with openssl. Arch uses openssl 1.0, lower patchlevels of 1.8.7 assumes 0.9. <br />
<br />
You can use newer patchlevels, like p299 '''or newer''' with:<br />
<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7-p299<br />
<br />
Another approach is to install local openssl via RVM:<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.8.7<br />
$ rvm install 1.8.7 -C --with-openssl-dir=$HOME/.rvm/usr<br />
<br />
==== Ruby 1.9.x won't compile with RVM ====<br />
<br />
Like with 1.8.x, earlier patchlevels don't like the OpenSSL 1.0. Then you can use the very same solution above, by installing openssl locally on RVM.<br />
<br />
$ rvm package install openssl<br />
$ rvm remove 1.9.1<br />
$ rvm install 1.9.1 -C --with-openssl-dir=/usr/local/rvm/usr</div>Trutch