Unlimited WordPress themes, graphics, videos & courses! Unlimited asset downloads! From $16.50/m
  1. Computer Skills
  2. Electronics

How to Install Ruby on Rails on Raspberry Pi


Ruby on Rails is quickly becoming more and more popular every day. Learning to develop in the Ruby language is a very valuable skill. In this tutorial I’ll show you how to install Rails onto a Raspberry Pi.


  • Raspberry Pi (Model B)
  • SD Card (running Debian Squeeze)
  • Micro-USB Power Cable
  • Ethernet Cable or USB Wi-Fi Adapter
  • USB Keyboard
  • USB Mouse (preferable, but not required)

Setting Up SSH

Step 1

Using SSH, or Secure SHell, will allow control the Raspberry Pi from another computer. In order to enable SSH, you must obtain the IP address of the Pi. To do so, type the following command into the LXTerminal application:

You'll then see something similar to this:

If you're using a wireless connection, in the wlan0 section, the IP address can be found on the second line, labelled inet addr. In this case, my IP address is

If you're using an ethernet connection, the IP address of the Pi can be found in the eth0 section.

Step 2

Enable SSH and then restart the Pi by typing the following commands into the LXTerminal window:

You should enter each line one at a time, and press the Return key after each line has been entered.

Step 3

On a Mac, open up Terminal, which can be found within the Applications > Utilities folder. Type the following command into the window:

You should replace with your own IP address. You'll then be asked for the password. Unless you've previously changed it, the password will be raspberry. Whilst you won't see each character being typed on the screen what you're typing is being entered.

If a security warning is displayed, double check that everything is ok, and then type either y or yes to continue the connection.

If you've connected successfully to the Pi, you'll see pi@raspberrypi ~ $ being displayed at the bottom of the Terminal window, similar to this:

Installing the Essentials

Step 1

You should begin by installing the prerequisites, to prepare for the installation of Rails. Type the following command into the Terminal window, once you've connected via SSH.

Step 2

If you come across a 404 Error, you'll likely need to update the package index, and this can be done using the following command.

Step 3

Whilst you're already getting the required packages, you'll need to retrieve the SSL package, SQL database package, and more.

Step 4

Open up the RVM, straight from its repository on GitHub.

Step 5

Once you've successfully installed the required packages, and have opened up the RVM, it's recommended that you run a script, just so that you can enable Ruby.

Testing the Installations

Step 1

You should now have successfully installed Ruby, and Rails. You can test for Ruby by typing the following command.

If installed correctly, you'll see a message confirming which version of Ruby is installed, when it was produced, and what it's using in order to work correctly.

Step 2

You can also test for Rails by typing in the following command.

JavaScript Runtime

Step 1

As Rails required a JavaScript runtime, you'll need to install a new Ruby gem called ExecJS, and then install a JS package. You should begin by installing the gem.

Step 2

As stated on the ExecJS GitHub repository, ExecJS supports all of the following runtimes:

  • therubyracer
  • therubyrhino
  • Node.js
  • Apple JavaScriptCore
  • Microsoft Windows Script Host

Install Node.js, by typing in the following command:

Creating a Simple Project

In order to test that Rails is fully functional on the Raspberry Pi, create a simple project, by adding a new project, going to its directory, adding a scaffold, migrating the database, and then starting up the server.

Step 1

Begin by creating a new Rails project, called tutorials.

Step 2

Go to the new directory you just created:

Step 3

You can now create a simple scaffold, called Steps by running the following command:

Step 4

Now migrate the database using the following command:

Step 5

Start the Rails server:

Step 6

If all's gone well, you'll see the new project in action in the browser by typing the IP address, followed by the port number (3000 for Rails), and then by the project name. For me, that'd be the following address.


That's it! You've successfully installed Ruby on Rails on a Raspberry Pi!

You began by enabling SSH, then installing the required software in order for Rails to function properly.

The best way to find out what you can do with your new Rails Server would be to play around with it, and see what it can do!

Looking for something to help kick start your next project?
Envato Market has a range of items for sale to help get you started.