Search code examples
rubyrbenv

Failed to install ruby 2.5.0 thru rbenv macOS High Sierra


I am using macOS High Sierra and have been trying to install ruby 2.5.0 thru rbenv but keep getting error as following

Apple LLVM version 9.0.0 (clang-900.0.39.2)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
compiling ./main.c
compiling dmydln.c
compiling miniinit.c
compiling dmyext.c
compiling miniprelude.c
translating probes probes.d
compiling bignum.c
compiling class.c
error: error reading '/dev/fd/9'
1 error generated.
clang: error: unable to remove file: Operation not permitted
dtrace: failed to compile script probes.d: Preprocessor failed to process input program
make: *** [probes.h] Error 1
make: *** Waiting for unfinished jobs....e

I tried brew doctor and brew upgrade rbenv ruby-build before install rbenv install -v 2.5.0

still getting the same error

Is anyone know how to solve this issue?


Solution

  • I had similar problem while installing ruby with ruby-build (used by rbenv and others) and I've avoided it for now using following work-around.

    This seems to be due to the dtrace being update with macOS 10.3.3.

    First try this, sudo chmod -s /usr/sbin/dtrace

    If that doesn't work then disable dtrace while installing ruby

    RUBY_CONFIGURE_OPTS="--disable-dtrace" rbenv install 2.5.0

    You can also export RUBY_CONFIGURE_OPTS="--disable-dtrace" to your .bashrc or .zshrc file.

    The maintaner of rbenv/ruby-build has notified this to ruby core team and hopefully be fixed soon.