📢 Newsroom Update

The iPhone 16 and iPhone 16 Pro lineups, Apple Watch Series 10, the new black titanium Apple Watch Ultra 2, AirPods 4, and new colors for AirPods Max are now available! Learn more >

You can make a difference in the Apple Support Community!

When you sign up with your Apple ID, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

After Security Update 2018-005 Sierra on 10.12, can't install native gems?!

Before the update, people missing ruby.h needed to install commandline tools; I see it still at

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h


But the fpm I installed with 'gem install fpm' now fails to run, complaining

-bash: /usr/local/bin/fpm: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby: bad interpreter: No such file or directory


Sweet. Reinstalling fpm fails; the first problem seems to be ffi. 'sudo gem install ffi' fails with:


Building native extensions. This could take a while...

ERROR: Error installing ffi:

ERROR: Failed to build gem native extension.


current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.10.0/ext/ffi_c

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20190115-16637-wd53jk.rb extconf.rb

mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h


The commandline tools are definitely installed; 'xcode-select --install' says

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

and no updates are available (except itunes).


I guess I'll try installing xcode 9.2 and its commandline tools (I've been using 8.0 and 8.2) and hope that magically brings back a working ruby.h...


This is on all four of my Mac OS 10.12 systems (macbook pro's and a mac mini).


MacBook Pro w/ Touch Bar (2018 or later)

Posted on Jan 15, 2019 4:10 PM

Reply

Similar questions

3 replies

Jan 15, 2019 4:55 PM in response to DanKegel

The System Ruby (and Python) frameworks and executables are installed by the operating system itself, not by Xcode, or the Command-Line tools. If you want to repair any damage to these, you will need to apply the appropriate macOS version combo update back over the existing version of macOS that is installed.


I never advise anyone to install gems (or even update gems) in the System Ruby framework, because if something goes south, and ruby becomes corrupted, it breaks Apple's sprinkling of Ruby scripts squirreled away in the System libraries, and Automator actions.


I recommend using a package manager (e.g. homebrew) to install the specific Ruby version Framework into /Library/Frameworks, and its linked binaries into /usr/local/bin. Now, you can add third-party modules without any threat to the operating system installed Ruby.


In my own case, I use RVM and keep Ruby v2.6.0 in my home directory where it is switchable with the System Ruby. There are other (e.g. rbenv) Ruby version managers than RVM.


You can verify that the security update did or did not install any Ruby related code. In the Terminal, run the following utility:


pkgutil --pkgs | egrep -i "SecUpd2018|Sierra" | more

pkgutil --files <the name of the security update from --pkgs output> | egrep -i ruby

Jan 24, 2019 4:08 PM in response to VikingOSX

There is no damage other than that caused by the operating system updates.

Apple intentionally or unintentionally shipped a new ruby lacking ruby.h.


$ pkgutil --pkgs | egrep -i "SecUpd2018|Sierra" | more

com.apple.pkg.Safari12.0.2Sierra

com.apple.pkg.Safari12.0.3Sierra

com.apple.pkg.update.os.SecUpd2018-006Sierra.16G1710

$ pkgutil --files com.apple.pkg.update.os.SecUpd2018-006Sierra.16G1710 | grep -i ruby | wc

18862 18862 2107786


That's a lot of files because the update included a whole new version of ruby. The new files are in directories

/Library/Ruby/Gems/2.3.0

/System/Library/Frameworks/Ruby.framework/Versions/2.3/

plus

/usr/bin/ruby

/usr/lib/libruby.2.3.0.dylib

/usr/lib/libruby.2.3.dylib

/usr/lib/libruby.dylib

/usr/share/file/magic/ruby

/usr/share/man/man1/ruby.1


ruby.h is not included.


I am not interested in using a non-platform ruby in this case; I want to use the one shipped by Apple.

Jan 24, 2019 5:57 PM in response to DanKegel

I simply do not install third-party gems into the System Ruby. That is why I have not encountered the issues that you have. I use RVM to maintain a separate, current Ruby version, compiled from sources (e.g. 2.6.0). I do sparingly add needed gems to that distribution. That distribution is in my home directory.


Apple is still installing the exact same System Ruby (2.3.7p456) in Mojave 10.14.3, as they did in High Sierra 10.13.0. There are ruby.h in the Xcode, command-line tools, Gems, and framework paths. These are all in a 2.0.0 path hierarchy when one would expect 2.3.0... so who knows what mischief Apple is up too.


Occasionally, I encounter a gem that was written to look for components where there is nothing to be found.

After Security Update 2018-005 Sierra on 10.12, can't install native gems?!

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.