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

Software Compatibility Best Practices

I spoke to some of the most talented and experienced software developers. I have created a guide that is filled with valuable insights and actionable ideas to boost developer productivity.

You will gain a better understanding of what's working well for other developers and how they address the software compatibility problems.

Get the Guide Now