Install Ruby on Rails in MacOS

1) configure nano .bash_profile
export PATH="$PATH:/Users/drini/bin:/usr/local/bin:/usr/local/sbin/:usr/local/mysql/bin"
need to re-open the terminal in order the change to take in the account

2) install XCode because we neeed to use the compiler GCC
xcode-select --install
check if the gcc is installed by executing gcc -v

3) install the package manager for the OS X called homebrew from
– check the installation version with the following commande
brew doctor and brew update
– please reopen the terminal inorder to take in account the changes

4) install or verify if ruby is installed through homebrew ( with RVM or the rbenv)
ruby -v
brew install rbenv
vi .bash_profile and add the following line eval "$(rbenv init -)"
– if you want to avoid the restart of the terminal you can run source ˜/.bash_profile
rbenv install --liste
rbenv install 2.5.0
rbenv rehash
rbenv versions
ruby -v
rbenv global 2.5.0

5) install RubyGems and the Gem called Rails
gem -v
gem update --system
gem install rails

6) install MySQL with homebrew command
brew install mysql
brew services start mysql
mysql -uroot -p
gem install mysql2

7) install webserver nginx (puma can be an alternative)
brew install nginx
sudo nginx
sudo nginx -s stop
sudo nginx
-Testing, Open Navigator it by going to URL:
– Configuration, The default place of nginx.conf on Mac after installing with brew is:

8) texteditors IDE’s and other business
– Atom, Sublime Textmate, RubyMIne Eclipse, Netbeans

9) Create project create database and manage projects
mdkdir Sites
cd Sites
rails new demo_site -d myssql
rbenv local2.5.0
mysql -ruser -p
CREATE DATABASE demo_site_dev
CREATE DATABASE demo_site_test
GRANT ALL PRIVILEGES ON demo_site_dev.* TO 'demo_user'@'localhost' IDENTIFIED BY 'demoPass';
GRANT ALL PRIVILEGES ON demo_site_test.* TO 'demo_user'@'localhost' IDENTIFIED BY 'demoPass';
rails db:schema:dump
rails server

This entry was posted in Apple-MacOS. Bookmark the permalink.

Leave a Reply