Skip to content

Instantly share code, notes, and snippets.

@prsimp
Last active December 11, 2015 07:38
Show Gist options
  • Save prsimp/4567288 to your computer and use it in GitHub Desktop.
Save prsimp/4567288 to your computer and use it in GitHub Desktop.
Upgrading Ruby and rbenv: A guide to upgrading Ruby and rbenv

Assumptions

  1. You installed rbenv and ruby-build via homebrew.
  2. (Optional) You are listening to Ke$ha.

Simple Upgrade

  1. Open a terminal.
  2. curl https://gist.githubusercontent.com/prsimp/4567288/raw/upgrade_it.sh | sh
  3. Drink some coffee or do something while Ruby compiles.
  4. Profit!

What the heck is this doing?

  1. Updates your homebrew formulae
  2. Upgrades ruby-build
  3. Installs ruby 2.1.1 and sets it as your default global Ruby (aren't we presumptious!)
  4. Installs the bundler and rails gems globally.
#!/usr/bin/env bash
set -e
cd $HOME
echo "$(tput setaf 2)Updating your homebrew formulae...$(tput sgr0)"
brew update
echo "$(tput setaf 2)\nUpgrading ruby-build to latest versions...$(tput sgr0)"
brew upgrade ruby-build
echo "$(tput setaf 2)\nInstalling Ruby 2.2.1...$(tput sgr0)"
rbenv install 2.2.1
rbenv global 2.2.1
echo "$(tput setaf 2)\nInstalling bundler and rails gems...$(tput sgr0)"
gem upgrade --system
gem install bundler rails --no-ri --no-rdoc
rbenv rehash
echo "$(tput setaf 2)\nDon't forget to bundle install in your project's root!$(tput sgr0)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment