Skip to content

Instantly share code, notes, and snippets.

@geekylucas
Last active August 29, 2015 14:08
Show Gist options
  • Save geekylucas/72f97470686bd1118ec3 to your computer and use it in GitHub Desktop.
Save geekylucas/72f97470686bd1118ec3 to your computer and use it in GitHub Desktop.
Installing a new ruby on MacOS with homebrew, chruby & ruby-install
#!/bin/bash -ex
# Assumes:
# homebrew
# chruby
# ruby-install
# postgres.app
# this bit might not be necessary, but can't hurt
brew upgrade ruby-install
# install the new ruby
ruby-install ruby 2.1.4
# make sure chruby can see the new ruby
source /usr/local/opt/chruby/share/chruby/chruby.sh
# make the new ruby active
chruby ruby-2.1.4
# update rubygems
gem update --system
# these gems are fequently used but often not defined in Gemfiles
gem install bundler pry omglog --no-ri --no-rdoc
# pg gem needs special flags, if we let bundler install it bad things will happen
PG_CONFIG_PATH=/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_config
ARCHFLAGS="-arch x86_64" gem install pg --no-ri --no-rdoc -- --with-pg-config=$PG_CONFIG_PATH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment