Can't install Ruby under Lion with RVM – GCC issues
This answer was edited multiple times and now contains several alternative solutions. Try the simple “Edit 3” solution first.
Ruby 1.9.3-p125 and later have official support for clang, so if you are installing such a version you should not need GCC. If you’re installing an older version of Ruby, read on.
To compile Ruby with GCC, you need a non-LLVM version of GCC, which is no longer included with Xcode 4.2. Install it yourself (or downgrade to Xcode 4.1 temporarily), then do CC=/usr/local/bin/gcc-4.2 rvm install 1.9.3 --enable-shared
(substituting the path to your non-LLVM gcc).
Edit: https://github.com/kennethreitz/osx-gcc-installer/downloads may help for installing GCC. There is also some info available by running rvm requirements
.
Edit 2: For an easier solution, you can try adding --with-gcc=clang
to the arguments to configure
for Ruby to use clang instead of GCC.
Edit 3: rvm install 1.9.3 --with-gcc=clang
does that for you.
Note: With current versions of Xcode you need to install the command-line tools separately from the Xcode menu -> Preferences -> Downloads -> Components. This is a pre-requisite for doing any compiling with Xcode on the command-line, not just Ruby.
Note 2: If something doesn't work after following the steps, try doing a reboot or re-login to ensure that the environment gets set correctly.
Note 3: Ruby versions prior to 1.9.3-p125 may not always be fully compatible with clang, so test your software thoroughly if using the “edit 3” solution in a production environment.
SUMMARY FOR STACK OVERFLOW
I was trying to install SiriProxy on a clean Lion installation on Xcode from App Store
I kept getting errors like : The provided CC(/usr/bin/gcc) is LLVM based.
bash-3.2$ rvm install 1.9.3
ERROR: The provided CC(/usr/bin/gcc) is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.
After 2 days finally got it working with these two lines:
http://stackoverflow.com/questions/8000145/ruby-rvm-llvm-and-mysql
bash-3.2$ rvm get head
bash-3.2$ CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared
Before that I had tried every stackoverflow article on Ruby and Lion so doing these may have done some setup that helped the above 2 steps work:
Things I tried included:
Running Install Xcode.app (I had downloaded from App Store - running this does futher installation)
Installing
https://github.com/kennethreitz/osx-gcc-installer/downloads may help for installing GCC.
Set up CC in
more /Users//.bash_profile
bash-3.2$ more /Users/<USERNAME>/.bash_profile
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
export CC=/usr/share/TargetConfigs/bin/gcc
First line came from SiriProxy install instruction https://github.com/plamoni/SiriProxy
2nd line export CC never seemed to work. So dont add.
It had many versions each pointing I finally used CC=/usr/bin/gcc-4.2 rvm install 1.9.3 --enable-shared
rvm install 1.9.3 --with-gcc=clang
Worked for me. This was on a brand new Lion with Xcode (had no "traditional" GCC).