Broken RubyGems configuration for some users under OS X 10.11

Originator:neocool2
Number:rdar://22979372 Date Originated:05-Oct-2015 11:26 PM
Status:Open Resolved:
Product:OS X Product Version:10.11
Classification:Serious Bug Reproducible:Sometimes
 
Summary:

I am a core team member of CocoaPods, which is distributed as a RubyGem. We are hearing some reports of our users that they’re unable to install any gems with binstubs successfully on OS X 10.11

$ sudo gem install cocoapods
Fetching: cocoapods-0.38.2.gem (100%)
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod

This seems to be caused by /Library/Ruby/Site/2.0.0/rubygems/defaults.rb existing on the affected systems. This doesn’t seem to exist on all systems, though, e.g. I am running OS X 10.11 and don’t have it.

Steps to Reproduce:

Unknown

Expected Results:

The system RubyGems should install their binstubs into /usr/local/bin

Actual Results:

The system RubyGems install their binstubs into /usr/bin — which is protected by System Integrity Protection and therefore fails

Regression:

This problem did not exist on earlier versions of OS X because SIP didn’t exist.

Notes:

Some relevant threads on our issue tracker:
https://github.com/CocoaPods/CocoaPods/issues/3736
https://github.com/CocoaPods/CocoaPods/issues/3692

Comments

Reply from Apple

We need more information to investigate this issue.

What is your RubyGems version? If you've installed a newer version then it won't install into /usr/local/bin unless you use -n /usr/local/bin The rubygems shipped with El Capitan will report $ gem env ... - EXECUTABLE DIRECTORY: /usr/local/bin ...

Please provide your response or results by updating your bug report.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!