Rails 5 Basics : Running the Server


  • To run your rails application on your machine and check your application's environment.


Step 1

Check the versions of installed ruby, rails and ruby gems by running the following commands in the terminal:

$ruby -v

The output on my machine is : ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]

$rails -v

The output on my machine is: Rails 5.0.0.alpha

$rails c
Loading development environment (Rails 5.0.0.alpha)
a2.2.3 :001 > Rails.version
 => "5.0.0.alpha" 

You can also check the version in the rails console.

$gem env

The output on my machine is: RUBYGEMS VERSION:

Step 2

Change directory to where you want to work on new projects.

$cd projects

Step 3

Create a new Rails project called blog by running the following command.

$rails new blog

Step 4

Open a terminal and change directory to the blog project.

$cd blog

Step 5

Open the blog project in your favorite IDE. For Textmate :

$mate .

Step 6

Run the rails server:

$rails s

Step 7

Open a browser window and enter http://localhost:3000. Welcome page is displayed as the home page.

Step 8

You can shutdown your server by pressing Control+C.

Step 9

Click on the 'About' link and check the versions of software installed. If the background of the about section is yellow, installation is fine. If it is red then something is wrong with the installation.


The rails generator automatically runs the Bundler command bundle to install your application dependencies by reading the Gemfile. The Gemfile contains all the gems that your application needs. rails s (s is a short-cut for server) runs your server on your machine on port 3000.


In this lesson you learned how to run the server locally. We also saw how to check if everything is installed properly on our machine. In the next lesson you will learn how to create a home page for your web application.

Related Articles

Ace the Technical Interview

  • Easily find the gaps in your knowledge
  • Get customized lessons based on where you are
  • Take consistent action everyday
  • Builtin accountability to keep you on track
  • You will solve bigger problems over time
  • Get the job of your dreams

Take the 30 Day Coding Skills Challenge

Gain confidence to attend the interview

No spam ever. Unsubscribe anytime.