cd to the folder where you want to store your new application. For me, this is
cd ~/workspace. Then,
rails new my_fancy_app
This creates a subfolder called
my_fancy_app and puts all of the boilerplate for a Rails application inside.
For all subsequent commands, you must
cd in to the application folder first; e.g.
cd my_fancy_app from
cd in to the folder you just downloaded. Then,
bundle install (or just
bundle for short) command fetches all of the 3rd party Ruby code that the application depends upon and installs it on your machine. You only need to do this once per application.
rails server -b $IP -p $PORT
or on your own computer
rails sis short for
rails server, like
rails cis short for
If the server started successfully, you should see output like the following. It may take a moment.
=> Booting WEBrick=> Rails 5.0.2 application starting in development on http://localhost:3000=> Run `rails server -h` for more startup options[2017-05-23 06:32:14] INFO WEBrick 1.3.1[2017-05-23 06:32:14] INFO ruby 2.3.4 (2017-03-30) [x86_64-darwin16][2017-05-23 06:32:15] INFO WEBrick::HTTPServer#start: pid=4618 port=3000
and then the cursor should be blinking at the bottom, but not at the end of your usual command prompt. This window is now dedicated to the web server app, and you can't run any other commands in it until you shut down the server.
If you need to run other command line stuff, open up a new window or tab.
If you got a "address already in use" error, then you must have an old
rails server running in another window or tab somewhere. Find it and Ctrl-C (or just close the tab).
If you have a syntax error in
config/routes.rb, then the server will refuse to even start up. See if the error message complains about a line in that file.
Ctrl-C. On Windows, you may be asked whether to terminate the job; say yes.
rails c for short.
Rails Console is a superpowered version of IRB, handy for testing snippets of code.
If the application you cloned requires database setup, then
will create the tables and columns.
If I provided some starter dummy data for you, then
will quickly pre-populate the tables for you, so you don't have to spend an hour in
rails console adding rows.
bundle install fails with a message about postgres or pgconfig, then
bundle install --without production
Go in to the
//= require_tree .
Refresh the page in Chrome; it should now be okay.
If you are still experiencing an error, try the following also:
Gemfile, delete the line
//= require turbolinks
bundle install and restart your server.