Skip to content

Instantly share code, notes, and snippets.

@yeban
Last active August 29, 2015 14:07
Show Gist options
  • Save yeban/df12d4ed1e624c64d023 to your computer and use it in GitHub Desktop.
Save yeban/df12d4ed1e624c64d023 to your computer and use it in GitHub Desktop.
#!/usr/bin/env sh
set -x
cd
# Download chruby to ~/.chruby.
wget -O /tmp/chruby-0.3.9.tar.gz https://github.com/postmodern/chruby/archive/v0.3.9.tar.gz
tar xvf /tmp/chruby-0.3.9.tar.gz -C /tmp
rm /tmp/chruby-0.3.9.tar.gz
rm -rf .chruby
mv /tmp/chruby-0.3.9/ .chruby
set +x
# Source chruby in the current shell.
source $HOME/.chruby/share/chruby/chruby.sh
set -x
# Add chruby to bashrc or zshrc as appropriate.
if [ -n "$BASH_VERSION" ]; then
echo $HOME/.chruby/share/chruby/chruby.sh >> ~/.bashrc
fi
if [ -n "$ZSH_VERSION" ]; then
echo $HOME/.chruby/share/chruby/chruby.sh >> ~/.zshrc
fi
# Download ruby-install to ~/.ruby-install.
wget -O /tmp/ruby-install-0.5.0.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
tar xvf /tmp/ruby-install-0.5.0.tar.gz -C /tmp
rm /tmp/ruby-install-0.5.0.tar.gz
rm -rf .ruby-install
mv /tmp/ruby-install-0.5.0/ .ruby-install
# Run ruby-install to install latest, stable Ruby. Will ask password to install
# dependencies.
.ruby-install/bin/ruby-install ruby
@yannickwurm
Copy link

  1. didn't work when wget wasn't installed (some macs)
  2. some bash read only ~/.profile rather than ~/.bashrc
  3. didn't work on eckart's biolinux either. (and I checked: sudo apt-get install chruby didn't work either)

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