How to Install RVM to Maintain Ruby Environments in macOS
Ruby is an object-oriented scripting language used to write powerful projects such as Metasploit and WPScan. Although Ruby ships with macOS, there isn't a clean way included in the operating system to update and manage Ruby environments (i.e., gem files and Ruby versions).
Why is that so important? The version of Ruby that ships with macOS is usually out of date, and since we're going to need at least the latest version of Ruby—and will have to manage gems (Ruby libraries)—some form of Ruby version management is required. Plus, in some cases, our hacking tools will require a specific Ruby version to run properly, and that means we'll need more than one functioning Ruby version.
Previously: How to Set Up Homebrew to Install & Update Open-Source Tools
In this tutorial, we'll be looking at installing RVM on macOS and updating to the latest version of Ruby.
Step 1Install GPG
The current RVM version signs and verifies all releases and the rvm-installer script. In most cases, it's all automated and the installer will check if the downloaded files are signed.First, we will need to install GPG, an open-source encryption tool which allows us to encrypt and sign data communications. You should have Homebrew installed already, if you've been following this series, so simply execute this command:
- brew install gpg
Step 2Install RVM
Next, we will execute the RVM installer with the command:- curl -L https://get.rvm.io | bash -s stable --autolibs=enabled --ruby
Step 3Check Our Ruby Version
Now we'll check the default version of Ruby on our machine using RVM:- rvm list
Step 4Install Older Ruby Versions
When we need an older Ruby version to run a tool, RVM makes that a piece of cake. First, open up iTerm and then enter the command:- rvm install 2.2.5
- rvm list known
Step 5Switch Between Ruby Versions
Now that we have multiple versions of Ruby installed, we can view which versions are installed with the command:- rvm list
- rvm use 2.2.5
Step 6Remove an Unused Ruby Version
If tools update to the latest version of Ruby, you may want to remove the outdated and unused versions on your machine. Simply enter the command:- rvm remove 2.2.5
- rvm uninstall 2.2.5
Comments
Post a Comment