Getting Ruby 1.8.7 installed on Mountain Lion (10.8)

10,531

Solution 1

I just figured it out! Please reference this question on SO

rvm can no longer install 1.8.7-p352 on Mac OS X Mountain Lion

rvm reinstall 1.8.7 --without-tcl --without-tk

Alternatively, try this installation order if you have Homebrew.

brew install tcl-tk

rvm reinstall 1.8.7

Solution 2

Just to follow up to Paul's post. I'm running OSX 10.8.2, had 1.9.3 install without issues, but 1.8.7-p370 also failed. I symlinked gcc-4.2:

sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2

...successfully ran:

brew install tcl

...but tk failed:

brewk install tk

If you're in the same spot, this command did the trick:

CC=/usr/local/bin/gcc-4.2 rvm reinstall 1.8.7 --without-tk

Solution 3

Latest Xcode provides only clang - not GNU gcc, you need to install gcc-4.2 to be able to compile Ruby 1.8.7 properly, following command will show available options:

rvm requirements

currently only ruby 1.9.3-p125 and later has limited support for clang, but this is limited support, and still errors can be found.

Share:
10,531

Related videos on Youtube

Paul
Author by

Paul

Updated on October 20, 2022

Comments

  • Paul
    Paul over 1 year

    I'm having a lot of trouble getting Ruby 1.8.7 installed on my clean install of Mountain Lion. I've looked around on Stack Overflow and don't see anything that specifically addresses this issue and hope that someone might have encountered this before.

    I'm using the command line tools that can be downloaded with Xcode

    I haven't had any problems installing Ruby 1.9.3 via RVM and HomeBrew. When I try to install 1.8.7 I get the following message after it tries to compile:

    I first ran the command

    rvm install 1.8.7
    

    This gave me this error

    The provided compiler '/usr/bin/gcc' is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`.
    

    After digging around a bit I tried

    rvm install 1.8.7 --with-gcc=clang
    
    Error running 'make ', please read /Users/paulzaich/.rvm/log/ruby-1.8.7-p370/make.log
    There has been an error while running make. Halting the installation.
    Ruby 'ruby-1.8.7-p370' was built using clang - but it's not (fully) supported, expect errors.
    Please be aware that you just installed a ruby that requires        2 patches just to be compiled on up to date linux system.
    This may have known and unaccounted for security vulnerabilities.
    Please consider upgrading to Ruby 1.9.3-194 which will have all of the latest security patches.
    

    At this point I did some more searching and found something about needing compile my own readline. RVM Does Not Install Ruby 1.9.2 on Snow Leopard: 'Error running 'make '

    This unfortunately seemed to corrupt my entire rvm install including 1.9.3. I tried to reinstall 1.9.3 and got the same errors I as I was getting with 1.8.7. I completely deleted RVM at this point and reinstalled. Had no problem installing 1.9.3 again.

    I also tried updating all versions of rvm based off of this post RVM issue with Mountain Lion. No luck there either.

    Update: I also tried using this walkthrough for REE 1.8.7 which recommended installing gcc-4.2. No luck unfortunately.

    Update 2: I reference rvm requirements and installed the following packages

    brew update
    brew tap homebrew/dupes 
    brew install autoconf automake apple-gcc42 
    rvm pkg install openssl
    

    So far so good. Then I referenced this post on needing to reference the GCC compiler. I determined that the links referenced might not be correct because I'm using homebrew? I found the compiler in my Cellar folder and used the following command

    CC=/usr/local/Cellar/apple-gcc42/4.2.1-5666.3/bin/gcc-4.2 rvm install 1.8.7
    

    No luck. Same error messages as before.

    • Paul
      Paul over 11 years
      I'd prefer to be able to move back and forth between rubies using RVM.
    • Frederick Cheung
      Frederick Cheung
      Do you realise that the ruby that comes preinstalled is on mountain lion is 1.8.7 ?
  • Paul
    Paul over 11 years
    Yeah I tried that as well. brew update brew tap homebrew/dupes brew install autoconf automake apple-gcc42 rvm pkg install openssl Then used the info on this link: stackoverflow.com/questions/6170813/… CC=/usr/bin/gcc-4.2 rvm install 1.8.7 No luck
  • Trip
    Trip over 11 years
    That worked! Just the reinstall and options. Also note that the brew installs would technically come first before the reinstall command. Thanks Paul
  • Sarkis Varozian
    Sarkis Varozian about 11 years
    Looks like the homebrew package name has since changed and combined tcl and tk into one: brew install tcl-tk
  • Joe Sak
    Joe Sak almost 11 years
    +1 on the reinstall and the -- options... the brew/rvm reinstall did not work for me (p371)
  • Ava
    Ava over 10 years
    Even this gives the same error Error running 'make -j24', please read /home/ava/.rvm/log/1378275411_ruby-1.8.7-p374/make.log There has been an error while running make. Halting the installation.