Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install the latest stable Ruby as a local user (non-root).
##
# A non-root installation of the latest Ruby with chruby
# Install chruby (https://github.com/postmodern/chruby#readme)
mkdir -p $HOME/src
cd $HOME/src
wget -O chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz
tar -xzvf chruby-0.3.9.tar.gz
cd chruby-0.3.9/
PREFIX=$HOME/.chruby make install
# Add the source lines to your ~/.bashrc or ~/.zshrc
echo "source ~/.chruby/share/chruby/chruby.sh" >> ~/.bashrc
echo "source ~/.chruby/share/chruby/auto.sh" >> ~/.bashrc
# Then set whatever Ruby version you want as default
echo "ruby-2.3" > ~/.ruby-version
# Install ruby-install (https://github.com/postmodern/ruby-install#readme)
mkdir -p $HOME/src
cd $HOME/src
wget -O ruby-install-0.6.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.0.tar.gz
tar -xzvf ruby-install-0.6.0.tar.gz
cd ruby-install-0.6.0/
PREFIX=$HOME/.ruby-install make install
# Install latest stable Ruby
$HOME/.ruby-install/bin/ruby-install --latest --no-install-deps ruby
# Now restart your terminal so chruby can detect your shiny new Ruby
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment