Created
April 30, 2009 00:46
-
-
Save speedmax/104172 to your computer and use it in GitHub Desktop.
switch between apple's ruby 1.8.6 and macports 1.9.1
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
| chruby () { | |
| v=`ruby -e "puts RUBY_VERSION.split('.')[0,2].join('.')"` | |
| rubyexes=( erb gem irb rake rdoc ri ruby testrb) | |
| for i in ${rubyexes[@]}; do | |
| sudo unlink "/usr/bin/${i}" | |
| if [ $v == "1.9" ];then | |
| src="/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/${i}" | |
| else | |
| src="/opt/local/bin/${i}1.9" | |
| fi | |
| sudo ln -s $src "/usr/bin/${i}" | |
| done | |
| echo "Now Running: "`ruby -v` | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment