Skip to content

Instantly share code, notes, and snippets.

@joemaller
Created January 14, 2013 05:01
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 joemaller/4527868 to your computer and use it in GitHub Desktop.
Save joemaller/4527868 to your computer and use it in GitHub Desktop.
A little script for boostrapping a basic ruby rbenv environment. The script installs rbenv and ruby-build from Homebrew, activates a new rbenv and then installs the rbenv-rhash and compass gems.
#!/usr/bin/env bash
# This script bootstraps a basic ruby rbenv environment using Homebrew
#
# Should be executed in the current shell by calling from source (or dot):
# $ source ./.rbenv
# $ . ./.rbenv
RUBY_VERSION='1.9.3-p362'
echo "Installing rbenv, and ruby-build"
brew update
brew install rbenv
brew install ruby-build
echo "Backing up .bashrc"
cp ~/.bashrc ~/$(date +.bashrc.backup_%Y_%m_%d_%H:%M:%S)
echo '
# Enable Ruby rbenv (via Homebrew)
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
' >> ~/.bashrc
echo "Installing Ruby $RUBY_VERSION to rbenv"
rbenv install $RUBY_VERSION
rbenv global $RUBY_VERSION
echo "Initializing rbenv"
eval "$(rbenv init -)"
echo "Installing rbenv-rehash"
gem install rbenv-rehash
rbenv rehash
echo "Installing Compass Gem"
gem install compass
echo "Sourcing .bashrc"
source ~/.bashrc
echo "All done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment