Last active
September 30, 2015 20:47
-
-
Save mgraupner/1859298 to your computer and use it in GitHub Desktop.
MacOS X 10.7.3 and XCode 4.3: Installing Ruby, Gem and Rails
This file contains 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
Made an update covering Macos 10.8 and ruby 2.0: https://gist.github.com/michaelsd/5224456 | |
- Install "Command Line Tools for XCode" (Get it from Apple Developer Program) or Install XCode via Appstore | |
where option one is the faster one, 170MB vs 1.xGB | |
- Install https://github.com/sstephenson/rbenv | |
git clone into your home folder; | |
set environment variables, see install docs of rbenv; | |
- Get libyaml | |
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz | |
configure | |
make && make install | |
Remember installation path: /usr/local/lib will be used to configure Ruby Source Code | |
- Get Ruby 1.9.3 Source | |
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.bz2 | |
- unpack Ruby with tar -xzf ruby-1.9.3-p125.tar.bz2 | |
- Configure, compile and install Ruby: (This is just one way to do it. On a clean new MacOS with XCode 4.3 there is no GCC Compiler anymore, so we have to use clang. This method was not supported by the ruby-build utility by the time of writing this) | |
./configure --prefix=$HOME/.rbenv/versions/1.9.3-p125 --with-gcc=clang --with-opt-dir=/usr/local/ | |
make | |
make install | |
- Issue the following commands: | |
rbenv rehash | |
rbenv global 1.9.3-p125 | |
Ruby should now be installed, test with ruby --version which should return something like: | |
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.2. | |
- Install gem: | |
wget http://rubyforge.org/frs/download.php/75856/rubygems-1.8.17.tgz | |
Unpack and ruby setup.rb in folder | |
- If we get a file 'lib' not found error: | |
gem install rdoc | |
- Install rails | |
gem install rails | |
- If you run the rails command and it could not be found, go to /usr/bin/ | |
and do a sudo mv /usr/bin/rails /usr/bin/rails.old and restart your shell | |
- Another Problem solved with missing XCode dependencies: | |
gem install rb-fsevent failed with Error extconf.rb:15:in `<main>': Could not find a suitable Xcode installation (RuntimeError) | |
Solutions: install rb-fsevent >= 0.9 which comes with an prebuild binary should help | |
references: https://github.com/thibaudgg/rb-fsevent/issues/31 | |
and https://github.com/thibaudgg/rb-fsevent/issues/20 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks, good to know that my time was invested well if i could help you with it.