7

I'm trying to install Ruby 2.1.3 on Mac OS X 10.9.5 using the rbenv install 2.1.3 command. However I get the error message below. I tried every suggestion on stack overflow and elsewhere. Nothing seems to be working. I currently have the original ruby version that came with 10.9.5, Ruby 2.1.3p242. Brew doctor says everything is fine and rbenv is up to date. Thanks so much! Trying to learn Ruby and Ruby on Rails but I can't get passed this stage.

Inspect or clean up the working tree at /var/folders/zg/s1jqg94n0hjggdnmb442n2lc0000gn/T/ruby-build.20141025184549.88303

Results logged to /var/folders/zg/s1jqg94n0hjggdnmb442n2lc0000gn/T/ruby-build.20141025184549.88303.log

Last 10 log lines:

linking shared-object openssl.bundle

installing default openssl libraries

compiling raddrinfo.c

compiling ifaddr.c

installing default socket libraries

compiling init.c

compiling constants.c

linking shared-object socket.bundle

linking shared-object ripper.bundle

make: [build-ext] Error 2

Community
  • 1
  • 1
WT0805
  • 71
  • 1
  • 1
  • 3
  • I don't know for sure, but here are two things to try. (1) `brew upgrade openssl` and then `rbenv install 2.1.3`. If that doesn't work, there is a similar [issue](https://github.com/sstephenson/ruby-build/issues/651) on Github (filed for Yosemite, but might be worth a try) — (2) either set `CC=/usr/bin/gcc` or `CC=clang` and then `rbenv install 2.1.3`. Hope it helps. – O-I Oct 26 '14 at 03:49
  • Thanks for the suggestion but didn't work. Still getting the same error message. – WT0805 Oct 26 '14 at 04:02
  • 1
    Another issue that might be worth looking through [here](https://github.com/sstephenson/ruby-build/issues/550). Try `brew upgrade readline` then `rbenv install 2.1.3`. Hopefully someone else will chime in if that doesn't work. Also might be worth filing an issue on the [ruby-build](https://github.com/sstephenson/ruby-build) repo — they seem to be pretty responsive and patient with figuring what exactly is going wrong. – O-I Oct 27 '14 at 00:10
  • Nope, didn't work either, still have the problem. Thanks so much for your help. Yes, hopefully someone else can chime in. – WT0805 Oct 27 '14 at 23:48
  • 2
    Another possible [thing](http://stackoverflow.com/a/26434459/2980254) to try if you haven't already is to update `rbenv` itself. If you are using `homebrew`: `brew update` `brew upgrade ruby-build` `brew upgrade rbenv` `rbenv install 2.1.3`. – O-I Oct 28 '14 at 18:21
  • Thanks, still working on a solution. – WT0805 Oct 29 '14 at 14:07

3 Answers3

6

I have a m1 mac and I also got this error installing ruby, this command worked for me:

export optflags="-Wno-error=implicit-function-declaration";

run this and then try rbenv install again.

eshirvana
  • 23,227
  • 3
  • 22
  • 38
Lily Li
  • 61
  • 1
  • 1
2

Did you try this:

CC=/usr/bin/gcc rbenv install 2.1.3

From this SO answer: Unable to build Ruby 2.1.3 on OSX 10.10 GM 3.0 with rbenv

Community
  • 1
  • 1
kakubei
  • 5,321
  • 4
  • 44
  • 66
1

I had to remove the existing openssl that came with macOS and instead install from brew with brew install openssl.

NOTE: I also had to disable SIP with csrutil disable and then remount root with writable permissions, with sudo mount -uw /.

Joshua Pinter
  • 45,245
  • 23
  • 243
  • 245