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

6
  • 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 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. Commented Oct 26, 2014 at 3:49
  • Thanks for the suggestion but didn't work. Still getting the same error message. Commented Oct 26, 2014 at 4:02
  • 1
    Another issue that might be worth looking through here. 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 repo — they seem to be pretty responsive and patient with figuring what exactly is going wrong. Commented Oct 27, 2014 at 0:10
  • Nope, didn't work either, still have the problem. Thanks so much for your help. Yes, hopefully someone else can chime in. Commented Oct 27, 2014 at 23:48
  • 2
    Another possible thing 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. Commented Oct 28, 2014 at 18:21

3 Answers 3

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.

Sign up to request clarification or add additional context in comments.

Comments

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

Comments

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 /.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.