Skip to content

Instantly share code, notes, and snippets.

@dbonates
Last active October 27, 2017 01:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbonates/5414174 to your computer and use it in GitHub Desktop.
Save dbonates/5414174 to your computer and use it in GitHub Desktop.
Ruby on Rails + rbenv + sqlite3 + mysql + postgresql on Mac
# install Command Line Tools for Xcode (*** if not yet!)
#Install Homebrew
$ ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
# Add Homebrews binary path to the front of the $PATH
$ echo "export PATH=/usr/local/sbin:$PATH" >> ~/.bash_profile
$ source ~/.bash_profile
# checar instalação do homebrew e possíveis pendências:
$ brew doctor
# atualizar homebrew
$ brew update
# It allows us to install different versions of Ruby and specify which version to use on a per project basis.
$ brew install rbenv ruby-build
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
$ source ~/.bash_profile
# install the latest stable of Ruby
$ rbenv install 1.9.3-p392
$ rbenv rehash
# set this version as the one to use globally
$ rbenv global 1.9.3-p392
# to ensure we have the correct version of Ruby loaded in our terminal window, it overrides both project-specific and global version
$ rbenv shell 1.9.3-p392
$ gem install bundler
$ rbenv rehash
# Skip rdoc generation (*** if not yet!)
echo 'gem: --no-rdoc --no-ri' >> ~/.gemrc
# handy to have installed since Rails defaults to using it with new projects
$ brew install sqlite3
# install rails
$ gem install rails
$ rbenv rehash
# mysql install mysql
$ brew install mysql
# Install PostgreSQL
$ brew install postgresql
# as first time install, initialize files and vars
$ initdb /usr/local/var/postgres -E utf8
# install an alias for postgresql as just pg (to use "{pg start|stop|restart}"
$ echo "alias pg='pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log'" >> ~/.bash_profile
$ . ~/.bash_profile
# if this is your first install, create a database with:
$ initdb /usr/local/var/postgres -E utf8
# update git for paranoia safe!
brew install git
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment