Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
a no-nonsense guide to setting up an rbenv based ruby on rails development environment on OSX using homebrew, rbenv, bundler, pow, anvil note: all these commands are to be entered at the terminal
# get homebrew
ruby -e "$(curl -fsSL"
# remove RVM ruby manager if installed... (credit
rvm implode
sudo rm /etc/rvmrc
rm ~/.rvmrc
# use homebrew to install rbenv and ruby-build
brew update
brew install rbenv
brew install ruby-build
# view available rubies
rbenv install --list
# fetch a ruby
rbenv install 1.9.3-p385
# bind global
rbenv global 1.9.3-p385
# temp load rbenv context
eval "$(rbenv init -)";
# install bundler
gem install bundler
# reset shims
rbenv rehash
# verify version
ruby --version
# create ~/.bundle/config and put the following in it to create a default bundle binary compile path as [projectdir]/vendor/bundle/bin:
BUNDLE_PATH: vendor/bundle
BUNDLE_BIN: vendor/bundle/bin
# Add the following to ~/.bash_profile (create the file if missing):
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
# add some easy terminal alias for bundler calls
alias b="bundle exec"
alias bi="bundle install --without production"
# add bundler binstubs to the path so relative binarys are auto run from a project dir
export PATH="./vendor/bundle/bin:$PATH"
# install pow (with apache proxy! so you can work alongside existing apache projects)
# install pow util, anvil
# install rails
rbenv shell 1.9.3-p385
gem install rails
# rebuild global binary proxies
rbenv rehash
# now you can cd to your base project folder and create new rails project (optionally with mysql)
rails new projectname --database=mysql
# set default rails version for project, creates .rbenv-version
cd projectpath
rbenv local 1.9.3-p385
# run bundler install to fetch all the gems
# symlink the project directory to ~/.pow
cd ~/.pow
ln -s projectpath
# view local app
# add bundler path to .gitignore to stop it uploading chunky binaries
# mysql2 gem install may require editing /usr/local/Cellar/mysql/5.XX.XX/bin/mysql_config
cflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space! removed: -Wno-null-conversion -Wno-unused-private-field
cxxflags="-I$pkgincludedir -Wall -Os -g -fno-strict-aliasing -DDBUG_OFF " #note: end space! removed: -Wno-null-conversion -Wno-unused-private-field
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.