macOS High Sierra: Setup Ruby on Rails
Pre-Requisites: * Homebrew
Install rbenv using:
brew install rbenv
Add the following to your terminal profile (.bash_profile or .zshrc etc):
eval "$(rbenv init -)"
Relaunch the Terminal or enter the following comand for the profile changes to take effect
Ensure that Terminal launches with no errors. If any, please check your syntax in terminal profile.
Verify that rbenv is installed using:
Install desired version of Ruby. As of this writing current stable version is 2.5.0
rbenv install 2.5.0
Verify ruby versions installed using:
Change permissions on rbenv ruby versions directories
chmod ug+wx ~/.rbenv/versions
The last command gives the Users and Groups Read and Write permissions to the versions directory where all the gems shall be stored.
If any of the commands throw errors of PERMISSION, prepend
sudo to the command and run it again.
sudo chmod ug+wx ~/.rbenv/versions
Lastly, Install Rails:
gem install rails or
sudo gem install rails
Confirm rails is installed using:
And you’re ready and set to start building Ruby on Rails applications.
Create your projects using:
rails new project_name
This will create a folder project_name and install all the necessary gems and dependencies.
Run your rails app:
cd project_name && rails server
This spins up a server and runs your app on
which is locally:
More detailed Reads: - http://guides.rubyonrails.org/getting_started.html - https://www.ruby-lang.org/en/documentation/
Photo by Matthew Mendez on Unsplash