Installing, using, or developing Ruby applications can vary from system to system. Different workstations might have different versions of Ruby installed. This can be a big problem if your application depends on a specific version to run properly. And changing the default system version can be very difficult, so what are your options. RVM, the Ruby Version Manager, is a separate application you can install to easily switch between different versions of Ruby.
- Basics of RVM (Ruby Version Manager)
- How To Install RVM
- Install Multiple Ruby Versions In One System
- Switch Versions on The Fly
- A Note On Shared Server Support
Basics of RVM (Ruby Version Manager)
As you may be aware, Ruby is an “interpreted” language. It uses an executable file to interpret your code and produce the proper output. This means the Ruby executable file need not be only present at the system level. You can have multiple Ruby executables in different places.
In principal, this is how RVM works. If you need to manage a different version of Ruby than the one installed on your system, you can use RVM to install and execute multiple versions.
What’s The Point Of Having Multiple Ruby Versions?
Or, why is this important, why does it matter? In general, it’s always best to run the latest and greatest versions of any mission-critical software. But often, particularly for developers, upgrades can be costly. A piece of software needs to be tested on the new version before comitting to it. Bugs may need to be worked out.
Likewise, imagine a routine system upgrade switches you to the newest version of Ruby, and this breaks a piece of software you use for work every day. Do you think you can easily switch back to the previous version until the bugs are worked out? Likely not.
These are instances in which the Ruby Version Manager can save you.
How To Install RVM
Installation of RVM may vary slightly depending on your operating system. But basically, installation involves the running of a remote installation script. Some users may need to update their bash profile to include RVM command support.
For Mac and Windows, the standard installation should be sufficient. The dedicated Ubuntu setup will likely work well for any Debian-based Linux distribution.
Install Multiple Ruby Versions In One System
Once you have installed RVM, you can install multiple versions of Ruby by simply typing the version number. For example, to install version
2.5.0 you can run the following:
rvm install 2.5.0
You can install any version of Ruby necessary to run your application.
Switch Versions on The Fly
To switch from the system Ruby version to your desired version, you can run the
use command. For example, if you want to use version
2.5.0 you can run the following command:
rvm use 2.5.0
And you can check your version to make sure that you have successfully made the switch:
You will see an output similar this one:
ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]
A Note On Shared Server Support
In most cases, you will be able to manage a local Ruby application using RVM and upload it to your server. If you need to change the default server version of Ruby available in shared hosting it is possible to install RVM. However, you may encounter an error during the compilation phase. If you have any issues while using RVM live in the server environment feel free to reach out to live support.
Launch your web presence quickly and easily with Shared Hosting. Our user-friendly hosting is perfect for everyone, providing the fastest shared hosting experience possible, all powered by cPanel.
Free Domain & SSL Certificates Unlimited Bandwidth 400+ One-Click Applications USA & European Data Centers