When I run
rvm install 1.9.3 --with-gcc=clang
on Mac OSX Lion, ruby does not compile, and I get the following error in (.rvm/log/ruby-1.9.3
If you are using rbenv and ruby-build instead of rvm, you have to define, which compiler should be used to build ruby:
# this export must be done before every new ruby build
export CC=gcc
# use the version you wish to install
rbenv install 1.9.3-p385
If it doesn't work, you need to install Gnu C Compiler (gcc) first:
brew update
brew tap homebrew/dupes
# install gcc, only once needed
brew install gcc
# You can view the installed GCC version, currently gcc-8
brew info gcc
# Maybe you have to tell, which gcc version must be used,
# to get it working.
export CC=gcc-8
For older Systems or not up to date systems install old GCC 4.2 version:
brew update
brew tap homebrew/dupes
# install apple-gcc, only once needed
brew install apple-gcc42
# Maybe you have to tell, which gcc version must be used,
# to get it working on newer systems
export CC=gcc-4.2
Until the ruby folks build a clang compatible ruby version, you have to export the CC variable before every build of a new ruby version or simply add the export to your .bashrc oder .zshenv file.