Installing Ruby on Ubuntu 17.04 Desktop Using rbenv


rbenv is a Ruby Version Management tool with a very small footprint. There are other version management tools available for ruby like rvm, but I prefer rbenv because I noticed that rvm slows down my shell. What a version management tool do is it allows you to install multiple version of the software and you can switch to any of the versions you require for the work you are doing.

This guide will help you in installing Ruby on your Ubuntu 17.04 desktop using rbenv. First step is to install dependencies for ruby. To do so, execute below commands in your terminal.

sudo apt-get update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-dev nodejs

Installing rbenv

Now, to install rbenv, execute below commonds in terminal.

git clone ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

Installing ruby-build

Now, execute below commands to install ruby-build

git clone ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

Installing Ruby

And, final step is to install ruby, execute below commands for installing ruby, you can replace the version numbers with the version you want to install. I am installing latest stable version which is 2.4.1

rbenv install 2.4.1
rbenv global 2.4.1

That’s it, you are done. Now you can execute below commond to check the active version of ruby installed in your system.

ruby -v

Hope the guide helped you for what it is intended for. If you face any issues or anything goes wrong, while doing the installation, please let me know in the comments section, I will try my best to help you out in every possible way. Cheers!!!

Exit mobile version