Skip to content

Instantly share code, notes, and snippets.

@jakemco
Last active August 29, 2015 13:56
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 jakemco/9009964 to your computer and use it in GitHub Desktop.
Save jakemco/9009964 to your computer and use it in GitHub Desktop.
Global rbenv Installation

Global rbenv Installation

Thanks to http://www.vxnick.com/blog/2012/04/setting-up-rbenv-globally/ for the steps, I'm assembling them into a gist for future reference.

Prerequisites

rbenv

apt-get install git

ruby-build

apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6 libreadline6-dev zlib1g zlib1g-dev

Install rbenv

Clone rbenv and the ruby-build plugin down to /usr/local/rbenv.

sudo git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv
sudo git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins

Modify /etc/skel/.profile to include:

#### begin rbenv configuration ####
## Remove these lines if you wish to use your own
## clone of rbenv (with your own rubies)

export RBENV_ROOT=/usr/local/rbenv
export PATH="$RBENV_ROOT/bin:$PATH"
eval "$(rbenv init -)"

# Allow local Gem management
export GEM_HOME="$HOME/.gem"
export GEM_PATH="$HOME/.gem"
export PATH="$HOME/.gem/bin:$PATH"
#### end rbenv configuration ####

Be sure to add that snippet to any existing users additionally.

Install Ruby

The following steps should be run as root, so su is very helpful

rbenv install 1.9.3-p125
rbenv global 1.9.3-p125
rbenv rehash

A useful gem for automatic rehashing is:

gem install rbenv-rehash

And TADA! we have a global rbenv install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment