Rubygems default paths are configured incorrectly on 10.11

Originator:mistydemeo
Number:rdar://24762558 Date Originated:21-Feb-2016
Status:Open Resolved:
Product:OS X Product Version:10.11.3 15D21
Classification: Reproducible:Always
 
OS X 10.11 customizes the Rubygems installation location to ensure that gems' binaries aren't written to /usr/bin, which would be disallowed by SIP, but to /usr/local/bin.

To do this, rubygems/defaults.rb from the builtin rubygems is patched: http://opensource.apple.com/source/ruby/ruby-113/patches/lib_rubygems_defaults.rb.diff

However, if the user upgrades Rubygems itself using `sudo /usr/bin/gem update --system`, Rubygems will install a new copy of itself in /Library/Ruby which contains an unpatched rubygems/defaults.rb, causing Rubygems to attempt to install gem binaries to /usr/bin again.

Rubygems provides a file to cover this usecase; if rubygems/defaults/operating_system.rb exists, it takes precedence over rubygems/defaults.rb. Apple should ship this file with the required customizations instead of patching rubygems/defaults.rb.

Related to rdar://22979372

Steps to Reproduce:
1. Run sudo /usr/bin/gem update --system

Expected Results:
Rubygems continues to work as expected.

Actual Results:
`/usr/bin/gem install` invocations will fail when gem binary installations are attempted to /usr/bin, and SIP prevents it.

Comments


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!