Created
October 9, 2014 11:46
-
-
Save mipmip/0d4381fe2e31903162f5 to your computer and use it in GitHub Desktop.
Change system ruby version in OS X Mavericks
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 | |
while getopts ":a :b" opt; do | |
case $opt in | |
a) | |
cd /System/Library/Frameworks/Ruby.framework/Versions/ | |
sudo rm Current | |
sudo ln -sf /System/Library/Frameworks/Ruby.framework/Versions/1.8 Current | |
sudo rm -rf /usr/bin/ruby | |
sudo ln -sf /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby /usr/bin/ruby | |
echo "-a set ruby 1.8.7" >&2 | |
;; | |
b) | |
cd /System/Library/Frameworks/Ruby.framework/Versions/ | |
sudo rm Current | |
sudo ln -sf /System/Library/Frameworks/Ruby.framework/Versions/2.0 Current | |
sudo rm -rf /usr/bin/ruby | |
sudo ln -sf /System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby /usr/bin/ruby | |
echo "-b set ruby 2.0" >&2 | |
;; | |
\?) | |
echo "Invalid option: -$OPTARG" >&2 | |
echo "use -a for 1.8 and -b for 2.9" >&2 | |
;; | |
esac | |
done | |
echo "current version:" >&2 | |
/usr/bin/ruby -v |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment