Ruby on Rails Q & A


How to install Ruby on Rails?

To install Ruby on Rails, you first need to ensure that you have Ruby and some other prerequisites installed. Here’s a step-by-step guide:


  1. Installing Ruby: Before you install Rails, you need Ruby. While many systems come with Ruby pre-installed, it’s recommended to use a version manager like `rbenv` or `RVM` to manage and install different Ruby versions. This gives you flexibility and avoids potential conflicts with the system’s Ruby.


    – For `rbenv`: 


      git clone ~/.rbenv

      echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc

      echo 'eval "$(rbenv init -)"' >> ~/.bashrc

      source ~/.bashrc

      git clone ~/.rbenv/plugins/ruby-build

      rbenv install 2.7.0  # Or whichever version you prefer

      rbenv global 2.7.0



    – For `RVM`:


      \curl -sSL | bash -s stable

      source ~/.rvm/scripts/rvm

      rvm install 2.7.0  # Or your preferred version

      rvm use 2.7.0 --default



  1. Installing SQLite3: Rails comes with SQLite3 as the default database. Most systems come with SQLite3 pre-installed. If not, you can easily install it using a package manager.


  1. Installing Node.js and Yarn: Rails 6 introduced Webpacker as a default JavaScript compiler. You’ll need Node.js and Yarn for managing front-end resources.

   curl -sL | sudo -E bash -

   sudo apt-get install -y nodejs

   curl -sS | sudo apt-key add -

   echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list

   sudo apt-get update && sudo apt-get install yarn



  1. Installing Rails: Once you’ve set up Ruby, you can install Rails using RubyGems:

   gem install rails



With these steps completed, you should have Ruby on Rails installed on your system. Remember, installation methods might slightly differ based on the OS and version you’re using, so always refer to the official documentation or guides tailored for your specific environment.

Previously at
Flag Argentina
time icon
Senior Software Engineer with a focus on remote work. Proficient in Ruby on Rails. Expertise spans y6ears in Ruby on Rails development, contributing to B2C financial solutions and data engineering.