In this post, I will give show the commands to install Ruby on Rails Development Environment on Mac OS
Source: https://github.com/rbenv/rbenv
brew install rbenv
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
rbenv install --list # To list the versions that you can install
rbenv install 3.0.2
rbenv global 3.0.2
Source: https://formulae.brew.sh/formula/postgresql
brew install postgresql
brew services start postgresql
psql -h localhost -d postgres
sudo gem install rails
rails new blog --database postgresql --skip-git --skip-turbolinks --skip-bootsnap --skip-spring --skip-action-text --skip-webpack-install
Configure config/database.yml
by adding the host of the database to to the development environment. Then run rake db:create
to create the database
bin/rails generate scaffold Post title:string body:text
rake db:migrate
./bin/rails s
brew update
brew install redis
brew services start redis
Add
gem 'redis'
to your Gemfile and run bundle install
Validate this by running rails console
and run a command like Redis.new.dbsize
. It should return 0
My name is Omar Qunsul. I write these articles mainly as a future reference for me. So I dedicate some time to make them look shiny, and share them with the public.
You can find me on twitter @OmarQunsul, and on Linkedin.