You would need to install
ruby
before you can install rails.
Mac already comes with ruby
installed based on how recent your macOS
is? Depending on what ruby
version you want for your development, the best way to install Ruby
is to use RVM. In your terminal, type the command below listed in steps:
Install rvm
curl -sSL https://get.rvm.io | bash -s stable --ruby
For Rails 3
, best version to install is ruby 1.9.3
rvm install 1.9.3
ruby -v #=> 1.9.3
Set your Ruby
version
rvm use 1.9.3 --default
Install Rails (this rails version requires ruby-version >=1.9.3)
gem install rails -v 4.2.7.1
rails -v #=> 4.2.7.1
Install rails app
rails new my_first_app #(this will install the app for you.)
cd my_first_app
rails s #(run the server)
Open the browser and type below in your URL
.
http://localhost:3000
Message saying 'Welcome to rails' will be displayed or similar.