Created
November 29, 2012 14:26
-
-
Save zh/4169434 to your computer and use it in GitHub Desktop.
New OS X machine setup for Ruby/Rails development
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/sh | |
| # Purpose: setup new OS X machine for Ruby/Rails development | |
| # Pre-Requirements: GCC (https://github.com/kennethreitz/osx-gcc-installer) | |
| # Usage: bash < <(curl -fsSkL https://raw.github.com/gist/4169434/rails-install.sh) | |
| RUBY_VERSION="1.9.3-p327" | |
| if [[ `which gcc` == "" ]]; then | |
| echo "[E] Please install GCC first. Exiting." | |
| exit 1 | |
| fi | |
| if [ ! -e /usr/local/bin/brew ]; then | |
| # we need write permissions for 'brew'. This will also ask for password | |
| sudo chown -R `whoami` /usr/local | |
| echo "[*] Installing Homebrew..." | |
| rm -rf /usr/local/Cellar /usr/local/.git && brew cleanup | |
| ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)" | |
| brew doctor | |
| fi | |
| echo "[*] Installing some utilities..." | |
| brew update | |
| brew install curl wget git | |
| brew install git-flow autoconf automake colordiff ctags | |
| brew install sqlite imagemagick libxml2 libxslt readline node.js | |
| echo "[*] Installs Ruby-${RUBY_VERSION} ..." | |
| brew install ruby-build rbenv | |
| if [ ! -d ${HOME}/.rbenv ]; then | |
| cat >> ${HOME}/.bash_profile <<DELIM | |
| # ---[ RBENV start ]--- | |
| export RUBY_HEAP_MIN_SLOTS=1000000 | |
| export RUBY_HEAP_SLOTS_INCREMENT=1000000 | |
| export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
| export RUBY_GC_MALLOC_LIMIT=100000000 | |
| export RUBY_HEAP_FREE_MIN=500000 | |
| export RBENV_ROOT="\${HOME}/.rbenv" | |
| if [ -d "\${RBENV_ROOT}" ]; then | |
| export PATH="\${RBENV_ROOT}/bin:\${PATH}" | |
| eval "\$(rbenv init -)" | |
| fi | |
| # ---[ RBENV end ]--- | |
| DELIM | |
| source ${HOME}/.bash_profile | |
| curl https://raw.github.com/gist/1688857/2-${VERSION}-patched.sh > /tmp/${RUBY_VERSION} | |
| CFLAGS="-O3" rbenv install /tmp/${RUBY_VERSION} | |
| rbenv global ${RUBY_VERSION} | |
| rbenv rehash | |
| # Cleanup | |
| rm -rf /tmp/${RUBY_VERSION} /tmp/ruby-* | |
| fi | |
| # TODO: some dotfiles install | |
| echo "[*] Installing Rails..." | |
| gem install bundler rails --no-ri --no-rdoc | |
| echo "[*] Installing Pow..." | |
| curl get.pow.cx | sh | |
| gem install powder --no-ri --no-rdoc | |
| rbenv rehash | |
| echo "[*] DONE." | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment