Created
April 12, 2012 17:00
-
-
Save nathantsoi/2369146 to your computer and use it in GitHub Desktop.
install rbenv and fast boot ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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