brew-gem: gem download fails with EPERM
karsten@qualifier:~$ brew gem install papertrail
==> Using the sandbox
==> Fetching papertrail from gem source
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /Users/karsten/.gem/specs/api.rubygems.org%443/specs.4.8
==> /usr/bin/gem install /Users/karsten/Library/Caches/Homebrew/papertrail-0.10.3.gem --no-ri --no-rdoc --no-wrapper --no-user-install --install-dir /usr/local/
Last 15 lines from /Users/karsten/Library/Logs/Homebrew/gem-papertrail/01.gem:
2017-08-03 00:07:18 +1200
/usr/bin/gem
install
/Users/karsten/Library/Caches/Homebrew/papertrail-0.10.3.gem
--no-ri
--no-rdoc
--no-wrapper
--no-user-install
--install-dir
/usr/local/Cellar/gem-papertrail/0.10.3
--bindir
/usr/local/Cellar/gem-papertrail/0.10.3/bin
ERROR: Could not find a valid gem '/Users/karsten/Library/Caches/Homebrew/papertrail-0.10.3.gem' (>= 0) in any repository
Looking at the source, it seems brew-gem just runs gem fetch ... from the homebrew cache directory (however it should check the exit code and not continue if the download failed)
I haven’t been able to figure out why gem fetch even fails in the first place though. The permissions of .gem/specs/api.rubygems.org%443 look fine. When I cd into the homebrew cache and run fetch manually it works:
karsten@qualifier:~/Library/Caches/Homebrew$ gem fetch papertrail --version 0.10.3
Fetching: papertrail-0.10.3.gem (100%)
Downloaded papertrail-0.10.3
After this brew gem install succeeds – it attempts the download again (which fails again), but then proceeds to install the gem:
karsten@qualifier:~/Library/Caches/Homebrew$ brew gem install papertrail
==> Using the sandbox
==> Fetching papertrail from gem source
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /Users/karsten/.gem/specs/api.rubygems.org%443/specs.4.8
Warning: Cannot verify integrity of papertrail-0.10.3.gem
A checksum was not provided for this resource
For your reference the SHA256 is: a29916a203a7960b25191f6b0bca671580285273a71f6de9455c08997fe9c5de
==> /usr/bin/gem install /Users/karsten/Library/Caches/Homebrew/papertrail-0.10.3.gem --no-ri --no-rdoc --no-wrapper --no-user-install --install-dir /usr/local/
🍺 /usr/local/Cellar/gem-papertrail/0.10.3: 157 files, 513.3KB, built in 4 seconds
karsten@qualifier:~$ gem --version
karsten@qualifier:~$ which gem
/usr/bin/gem
karsten@qualifier:~$ gem --version
2.6.12
karsten@qualifier:~$ which ruby
/usr/bin/ruby
karsten@qualifier:~$ ruby --version
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]
karsten@qualifier:~$ brew --version
Homebrew 1.3.0-15-g2ad03b8
Homebrew/homebrew-core (git revision 4b5dd; last commit 2017-08-02)
karsten@qualifier:~$ brew info brew-gem
brew-gem: stable 0.8.1, HEAD
Install rubygems as homebrew formulae
https://github.com/sportngin/brew-gem
/usr/local/Cellar/brew-gem/0.8.1 (10 files, 11.9KB) *
Built from source on 2017-08-03 at 00:24:08
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/brew-gem.rb
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 2
- Comments: 15
Commits related to this issue
- Fix sandbox permissions with gem fetch Fixes #47. — committed to sportngin/brew-gem by nicksieger 7 years ago
- Fix sandbox permissions with gem fetch Fixes #47. — committed to sportngin/brew-gem by nicksieger 7 years ago
A’ve made workaround for personal usage. Open
/usr/local/Cellar/brew-gem/0.8.1/lib/brew/gem/cli.rbin text editor, go to line77and replacesystem "brew #{command} #{filename}"withsystem "brew #{command} --no-sandbox #{filename}". I’m not a Ruby developer, so I don’t know the right solution how to fix this issue to make a PR.