Ruby-build: Ruby 2.3.1 build issues on Mac OS X El Capitan 10.11.6

Created on 9 Sep 2016  ·  23Comments  ·  Source: rbenv/ruby-build

I am getting an odd error when building 2.3.1. I get one of two errors:

BUILD FAILED (OS X 10.11.6 using ruby-build 20160602)

Inspect or clean up the working tree at /var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20160909104415.25429
Results logged to /var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20160909104415.25429.log

Last 10 log lines:
compiling vm_backtrace.c
compiling vm_trace.c
compiling thread.c
compiling cont.c
compiling ./missing/explicit_bzero.c
compiling ./missing/setproctitle.c
compiling dmyenc.c
make: ./config.status: Permission denied
make: *** [ruby-runner.c] Error 1
make: *** Waiting for unfinished jobs....

or

BUILD FAILED (OS X 10.11.6 using ruby-build 20160602)

Inspect or clean up the working tree at /var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20160909110514.33878
Results logged to /var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20160909110514.33878.log

Last 10 log lines:
compiling enc/unicode.c
compiling enc/utf_8.c
compiling enc/trans/newline.c
linking miniruby
generating encdb.h
make: ./miniruby: Permission denied
make: ./miniruby: Permission denied
make: *** [.rbconfig.time] Error 1
make: *** Waiting for unfinished jobs....
make: *** [encdb.h] Error 1

I have checked and there is nothing strange about the perms of these files. Perhaps antivirus or something like that is the culprit?

However if I cd /var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20160909110514.33878/ruby-2.3.1 and run make install it seems to install it successfully to ~/.rbenv/versions/

Any ideas or can I provide more information? Does installing ruby 2.3.1 this way cause any problems? make test also passed.

Most helpful comment

I hade the second problem described here, probably because Xcode was upgraded. Solved by running

xcode-select --install

All 23 comments

I'm getting different errors in a similar environment.

❯ rbenv install 2.3.1                                                       0 < 16:24:46
Downloading ruby-2.3.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.1.tar.bz2
Installing ruby-2.3.1...

BUILD FAILED (OS X 10.11.6 using ruby-build 20160602)

Inspect or clean up the working tree at /var/folders/lj/kndx6mlx3flcd0gl8xp7__680000gn/T/ruby-build.20160914162742.65586
Results logged to /var/folders/lj/kndx6mlx3flcd0gl8xp7__680000gn/T/ruby-build.20160914162742.65586.log

Last 10 log lines:
  Referenced from: /private/var/folders/lj/kndx6mlx3flcd0gl8xp7__680000gn/T/ruby-build.20160914162742.65586/ruby-2.3.1/./miniruby (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

dyld: Symbol not found: _clock_gettime
  Referenced from: /private/var/folders/lj/kndx6mlx3flcd0gl8xp7__680000gn/T/ruby-build.20160914162742.65586/ruby-2.3.1/./miniruby (which was built for Mac OS X 10.12)
  Expected in: /usr/lib/libSystem.B.dylib

make: *** [encdb.h] Trace/BPT trap: 5
make: *** Waiting for unfinished jobs....
make: *** [.rbconfig.time] Trace/BPT trap: 5

Puzzled by the references to built for Mac OS X 10.12 which doesn't officially come out for a week or so. I'm running 10.11.6

I hade the second problem described here, probably because Xcode was upgraded. Solved by running

xcode-select --install

@stenlarsson nailed it. Thanks!

Seems that installing Xcode on a new machine doesn't automatically install the command line tools. Could have sworn that used to be the case. Or at least they would prompt you to.

@pc-mreeves Might that be the cause of your problems as well?

It could definitely be related. However, IIRC I did not need to run that command because I ran the homebrew install first which installs the command line tools:
https://raw.githubusercontent.com/Homebrew/install/master/install

If I try to run it again I get this:
xcode-select: error: command line tools are already installed, use "Software Update" to install updates

I'll update and see if that fixes the issue... (after 3.44 gigs (!!!) downloads and installs...)

@pc-mreeves Did the App Store download fix the problem for you?

Unfortunately no... As I mentioned I had manually run make install on 2.3.1 so I didn't want to re-install that. So I tested by installing 2.2.5 and got the same error "make: ./miniruby: Permission denied". I suspect it might be Sophos antivirus or some other random culprit.

I can still cd to the directory and run make install and then it works.

@pc-mreeves Thank you for the reply!

May I ask: when you say, "I can still cd to the directory and run make install and then it works." which directory are you referring to?

(Sorry had to edit this because 2.2.1 is failing with a different error)

When the rbenv install 2.2.5 -v command fails it says something like:

/var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20161003095011.89195 ~
Downloading ruby-2.2.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.5.tar.bz2
/var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20161003095011.89195/ruby-2.2.5 /var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20161003095011.89195 ~
Installing ruby-2.2.5...

**SNIP**

linking miniruby
generating encdb.h
make: ./miniruby: Permission denied
make: ./miniruby: Permission denied
make: *** [.rbconfig.time] Error 1
make: *** Waiting for unfinished jobs....
make: *** [encdb.h] Error 1

If I cd to /var/folders/_y/qc89fk7n3m1f1p5pt8kpsgvdv009dp/T/ruby-build.20161003095011.89195 I can run make install and it will complete successfully.

Confirmed -- I got the same output re: miniruby permissions, and a make install solved it. Thanks for documenting this.

I'll also note my ruby is 2.3.1. Apparently this problem occurs on multiple versions of ruby. Thank you for documenting a workaround.

@pc-mreeves thank you for your suggestion to cd into the working tree ie. /var/folders/jj/wc_0mglj53x4rlnqxl9yzkk467jj82/T/ruby-build.20161023213421.54245 and then run make install after i did this ruby 2.3.1 successfully built! Then to start using the latest version I had to write rbenv global 2.3.1 to my terminal.

It seem for 2.3.1, under the working tree, there is another folder called ruby-2.3.1, needs to go there and then make install to install the ruby 2.3.1

I'm getting this when make install..

JM:ruby-build.20161117072715.65539 jm$ make install
make: *** No rule to make target `install'. Stop.
JM:ruby-build.20161117072715.65539 jm$

I got the same error when I was trying to install ruby 2.4.0 on OSX Yosemite 10.10.5, which is resolved by prefixing install command with an sudo.

But why do I have to append an sudo before rbenv install 2.4.0? I thought rbenv is installing everything into my ~/.rbenv, isn't that the truth?

I think prefixing install command with sudo defeat the purpose of having rbenv in home folder, you'll have write permission issue with your $HOME/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0 immediately after ruby installation, and you have to do sth. like sudo chown -R <your user name>:staff $HOME/.rbenv to make gem install bundler works.

This is still an issue 2 years later

BUILD FAILED (OS X 10.13.6 using ruby-build 20180822)

This makes me so sad - even with a fairly simple workaround. xcode-select --install is not the root cause. It is potentially a cause, but not the only one.

Closing due to staleness. If there is more recent information, steps to reproduce, workarounds, please open a new issue! 🙇

Our team still has this issue.

$ ruby-build 2.6.1 ~/.rubies/ruby-2.6.1                                                                                                                          Thu Mar  7 08:00:36 2019
ruby-build: use openssl from homebrew
Downloading ruby-2.6.1.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.1.tar.bz2
Installing ruby-2.6.1...
ruby-build: use readline from homebrew

BUILD FAILED (OS X 10.14.3 using ruby-build 20190130)

Inspect or clean up the working tree at /var/folders/fj/wd8pp7d54rj2gmklzybhx0_r78033x/T/ruby-build.20190307080037.92628
Results logged to /var/folders/fj/wd8pp7d54rj2gmklzybhx0_r78033x/T/ruby-build.20190307080037.92628.log

Last 10 log lines:
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
compiling ./main.c
compiling dmydln.c
make: ./tool/darwin-cc: Permission denied
make: ./tool/darwin-cc: Permission denied
make: *** [main.o] Error 1
make: *** Waiting for unfinished jobs....
make: *** [dmydln.o] Error 1

In my particular case, the machine is new install of MacOS (vs upgraded) with:

  • MacOS 10.14.3 (Mojave)
  • Homebrew 2.0.3
  • Xcode 10.1
  • ruby-build 20190130

Workaround to cd /var/folders/.../ruby-2.6.1 and run make install from original post still works.

What can we do to help troubleshoot and find resolution?

July 2019, this still happens.... workaround... cd into the folder of the build and make install

This is still a problem. I don't compile stuff very often so this was an all-morning struggle.

To provide some specifics for others in this situation:
I was patching 2.4.2 ruby so that ruby-prof could dump memory.

https://github.com/skaes/rvm-patchsets

After downloading the patches, this was the command that failed with the permission issue:
cat *.patch | rbenv install --patch -f 2.4.2

error:

Inspect or clean up the working tree at /var/folders/99/8h26v_fs6d76rfhsyxkj89hw7807y2/T/ruby-build.20190830111832.57168
Results logged to /var/folders/99/8h26v_fs6d76rfhsyxkj89hw7807y2/T/ruby-build.20190830111832.57168.log

Last 10 log lines:
...
make: ./config.status: Permission denied

The file it will fail on with permissions can vary but this was my fix:

cd .rbenv/versions/
mkdir 2.4.2
mkdir 2.4.2/lib
cd /var/folders/99/8h26v_fs6d76rfhsyxkj89hw7807y2/T/ruby-build.20190830111832.57168/ruby-2.4.2
make install

make install works - but if I do that it does not link to homebrew's openSSL. How do we make sure make install uses homebrew's openSSL

Same problem here on MacOS 10.15.1.

I solved the problem doing the cd plus make install. However, I am using asdf to manage my environment, and I needed to do a few things to make asdf work properly:

  1. Try to install ruby: asdf install ruby 2.5.6. It fails.
  2. Before running make install, ensure that the following folders (change the version) are created, and openssl is installed:
mkdir -p ~/.asdf/installs/ruby/2.5.6/bin
mkdir -p ~/.asdf/installs/ruby/2.5.6/lib
mkdir -p ~/.asdf/installs/ruby/2.5.6/include 
  1. Install openssl: cd /var/folders/path/to/ruby-build/openssl-1.1.1b && make install
  2. Install Ruby: cd /var/folders/path/to/ruby-build/ruby-2.5.6 && make install

After the installation completes, set the ruby version in asdf. I needed to asdf reshim in order to asdf to be able to see it.

Update 06-12-2019: SSL certificates fix

After running the commands above, I was able to run ruby, install bundler and properly install gems. However, I faced issues with SSL. For instance, I got the unable to get local issuer certificate error when trying to make SSL calls. I noticed that there were missing steps in ruby-build that I did not manually run:

cd ~/.asdf/installs/ruby/2.5.6/openssl/ssl
security find-certificate -a -p /Library/Keychains/System.keychain > "cert.pem"
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "cert.pem"

Now you should be able to see everything is fine with: curl -sL https://git.io/vQhWq | ruby

Update 20-02-2020: Still happening

  • macOS Catalina 10.15.3
  • Ruby 2.7.0

Same issue on MacOS 11. cd into working directory and make install fixes it.

Dec. 2019 and still happening!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Lukom picture Lukom  ·  5Comments

denisemauldin picture denisemauldin  ·  4Comments

k0kubun picture k0kubun  ·  3Comments

fguillen picture fguillen  ·  5Comments

dpaluy picture dpaluy  ·  6Comments