How can I install Ruby 1.9.3 in Mac OS X Mountain Lion without Xcode?
osx-gcc-installer turns out to be a very good option to replace Xcode in order to install Ruby 1.9.3
These are the steps I have followed:
- Download & install the latest version of osx-gcc-installer here (GCC-10.7-v2 is fine): https://github.com/kennethreitz/osx-gcc-installer
- Install RVM as usual and select 1.9.3-head as the default ruby installation: https://rvm.io/rvm/install/
- Install Homebrew: https://github.com/mxcl/homebrew/wiki/installation
- Install libksba to resolve some dependencies with Ruby 1.9.3:
brew install libksba
That's it! You should now have Ruby 1.9.3 installed on Mountain Lion working perfectly.
If you need some other packages, install them now through Homebrew, such as Imagemagick for example: brew install imagemagick
It's possible that you need XQuartz for Homebrew to work properly, as Apple is not shipping X11 since Mountain Lion. You can download it here: http://xquartz.macosforge.org/trac/wiki
EDIT:
Now (since 29th July) Command line tools for Xcode 4.4 are available.
So, the new steps are these:
- Download & install Command line tools for Xcode 4.4 (you don't need to download Xcode): https://developer.apple.com/downloads/index.action
- Install Homebrew: https://github.com/mxcl/homebrew/wiki/installation
- Install automake:
brew install automake
- Install RVM as usual and select 1.9.3-head as the default ruby installation: https://rvm.io/rvm/install/
Optional step: You may need XQuartz for some components, for example for Imagemagick, so download & install XQuartz: http://xquartz.macosforge.org/trac/wiki
How can I install Ruby 1.9.3 in Mac OS X Lion?
Try using the clang compiler instead of the default:
rvm install 1.9.3 --with-gcc=clang
Can't install Ruby 1.9.3 on Mac OSX 10.7.5
RVM has an updated command to install all required libraries:
rvm get head
rvm requirements run
It might ask you for your password (for sudo
).
After that run:
rvm install 1.9.3 --with-opt-dir=`brew --prefix readline` --without-tcl --without-tk
Update RVM 1.19+
RVM takes care of it all:
rvm get stable
rvm autolibs homebrew
rvm install 1.9.3
Installing ruby 1.9.3 on Mac OSX 10.8.2
Try this to let rvm
know which gcc
to use:
CC=/usr/bin/gcc-4.2 rvm install 1.9.3
Or, if you want to use the Homebrew-installed gcc
:
CC=/usr/local/bin/gcc-4.2 rvm install 1.9.3
It depends on where the gcc-4.2
interpreter is.
Two alternatives:
rvm install 1.9.3 --with-gcc=clang
Or use ruby-build
.
EDIT September 7, 2013: Another alternative that I'm liking quite a lot for installing Rubies is ruby-install. It's in the spirit of the same author's chruby. Simple and gets the job done well.
Trouble Installing Ruby 1.9.3 on Mac OSX 10.9.4
Error: No available formula for gcc46
Try:
rvm install 1.9.3 --with-gcc=clang
Or install xcode:
xcode-select --install
What's a proper way to install Ruby 1.9.3 on OS X Lion with Xcode 4.3?
Update:
See this link for the process required to get GCC-4.2 onto a machine with Xcode 4.3 without overwriting other components.
Xcode 4.3, Homebrew, and Ruby
It will obviate the need for the instructions below:
RVM should work if you set the default compiler for RVM to gcc. Place this in your .bashrc
or .zshrc
.
export CC=/usr/bin/gcc-4.2
RVM should then use GCC to compile.
If you don't want to have CC
set permanently then you could try installing with:
CC=/usr/bin/gcc-4.2 rvm install 1.8.7
Error installing Ruby 1.9.3 on OS X 10.8.1
There's something weird happening with RVM, it's not choosing the patchlevel correctly. There's lots of references to ruby-1.9.3-
which should be ruby-1.9.3-p327
. I think that's why it can't fetch the archive, should be nothing to do with Xcode.
Try updating your RVM by doing rvm get stable
and then try again.
Related Topics
Ruby on Rails Scalability/Performance
Ruby/Rails: Converting a Date to a Unix Timestamp
File.Expand_Path("../../Gemfile", _File_) How Does This Work? Where Is the File
Docker for MAC - Mkmf.Rb Can't Find Header Files for Ruby
Bundle Failing - Can't Find the Postgresql Client Library (Libpq)
How to Extract a Sub-Hash from a Hash
Ruby and "You Must Recompile Ruby with Openssl Support or Change the Sources in Your Gemfile"
Difference Between Has_One and Belongs_To in Rails
Any Success with Sinatra Working Together with Eventmachine Websockets
Is "Extend Self" the Same as "Module_Function"
How to Do a Safe Join Pathname in Ruby
Bundler Cannot Install Any Gems Without Sudo
"Which in Ruby": Checking If Program Exists in $Path from Ruby
How to Merge Two Hashes Without Overwritten Duplicate Keys in Ruby
Error: SASS Installation for Windows
Ruby Read CSV File as Utf-8 And/Or Convert Ascii-8Bit Encoding to Utf-8
Actionview::Template::Error (Incompatible Character Encodings: Utf-8 and Ascii-8Bit)