Skip to content

Instantly share code, notes, and snippets.

@nathantsoi
Created April 12, 2012 17:00
Show Gist options
  • Save nathantsoi/2369146 to your computer and use it in GitHub Desktop.
Save nathantsoi/2369146 to your computer and use it in GitHub Desktop.
install rbenv and fast boot ruby
#!/bin/bash
# Nathan Tsoi 2012
# mad props:
# https://github.com/sstephenson/rbenv
# https://github.com/sstephenson/ruby-build
# https://github.com/mxcl/homebrew/wiki/installation
# https://raw.github.com/gist/1688857
#remove rvm
rvm &>/dev/null
if [ ! $? -gt 0 ] ; then
echo please remove or comment out the rvm import from your ~/.bash_profile
echo it probably looks like:
echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"'
exit 0
fi
#rbenv
rbenv &>/dev/null
if [ $? -gt 0 ] ; then
cd ~
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo '# rbenv' >> ~/.bash_profile
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
else
echo 'rbenv is installed, skipping'
fi
#rbenv-gemset
PLUGINS=~/.rbenv/plugins
if [ ! -d $PLUGINS/rbenv-gemset ] ; then
mkdir -p $PLUGINS
cd $PLUGINS
git clone git://github.com/jamis/rbenv-gemset.git
else
echo rbenv-gemset is installed, skipping
fi
#apple-gcc42, required for ruby-build
brew list &>/dev/null
if [ $? -gt 0 ] ; then
echo 'you need homebrew: https://github.com/mxcl/homebrew/wiki/installation'
exit 0
fi
brew list apple-gcc42 &>/dev/null
if [ $? -gt 0 ] ; then
brew update
brew tap homebrew/dupes
brew install apple-gcc42
brew link apple-gcc42
else
echo 'apple-gcc42 is installed, skipping'
fi
#ruby-build
ruby-build --definitions &>/dev/null
if [ $? -gt 0 ] ; then
git clone git://github.com/sstephenson/ruby-build.git
cd ruby-build
./install.sh
else
echo 'ruby-build is installed, skipping'
fi
#install some ruby 1.9.2
ONENINETWO=1.9.2-p290
rbenv versions | grep $ONENINETWO &>/dev/null
if [ $? -gt 0 ] ; then
rbenv install $ONENINETWO
rbenv rehash
else
echo ruby $ONENINETWO is installed, skipping
fi
#and superfast ruby 1.9.3
ONENINETHREE=1.9.3-p125-perf
rbenv versions | grep $ONENINETHREE &>/dev/null
if [ $? -gt 0 ] ; then
curl https://raw.github.com/gist/1688857/rbenv.sh | sh
# set the global default to 1.9.3
rbenv global 1.9.3-p125-perf
echo "# https://raw.github.com/gist/1688857
export RUBY_HEAP_MIN_SLOTS=1000000
export RUBY_HEAP_SLOTS_INCREMENT=1000000
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1
export RUBY_GC_MALLOC_LIMIT=1000000000
export RUBY_HEAP_FREE_MIN=500000" >> ~/.bash_profile
else
echo ruby $ONENINETHREE is installed, skipping
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment