You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
HOMEBREW_VERSION: 4.2.20-108-g7e0c137
ORIGIN: https://github.com/Homebrew/brew
HEAD: 7e0c137955d269befdd69f01fa989fb38c2b49b5
Last commit: 32 hours ago
Core tap HEAD: aed95828f408efc65c54031a59d715dff7dd8d52
Core tap last commit: 25 minutes ago
Core tap JSON: 06 May 01:19 UTC
Core cask tap HEAD: 54aca2bdbae5efeb6d337653fd48b4842724024f
Core cask tap last commit: 12 minutes ago
Core cask tap JSON: 06 May 01:19 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_DEVELOPER: set
HOMEBREW_EDITOR: subl
HOMEBREW_MAKE_JOBS: 8
HOMEBREW_NO_ANALYTICS: set
HOMEBREW_NO_AUTO_UPDATE: set
HOMEBREW_NO_EMOJI: set
HOMEBREW_NO_INSTALL_CLEANUP: set
HOMEBREW_SORBET_RUNTIME: set
Homebrew Ruby: 3.1.4 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.1.4/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 15.0.0 build 1500
Git: 2.45.0 => /opt/homebrew/bin/git
Curl: 8.4.0 => /usr/bin/curl
macOS: 14.4.1-arm64
CLT: 15.3.0.0.1.1708646388
Xcode: 15.1
Rosetta 2: false
What were you trying to do (and why)?
I have a ruby project with a Gemfile that sources a gem from a git source. When I run bundle update to check for gem updates, this particular gem has been having issues, seemingly randomly. Today I figured out that this issue happens after brew cleanup has been run.
What happened (include all command output)?
$ cd homebrew-bug-repro
$ ls
Gemfile
$ cat Gemfile
source"https://rubygems.org"
gem "clogger", git: "http://bogomips.org/clogger.git"
$ bundle install
Fetching http://bogomips.org/clogger.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..
Bundle complete! 1 Gemfile dependency, 3 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
$ bundle update
Fetching http://bogomips.org/clogger.git
Resolving dependencies...
Fetching gem metadata from https://rubygems.org/..
Bundle updated!
$ bundle show clogger
/opt/homebrew/lib/ruby/gems/3.3.0/bundler/gems/clogger-4ae4cf792bd7
At this point, everything is working just fine. Here's how to break it:
$ brew cleanup --dry-run
Would remove (empty directory): /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f/refs/tags
Would remove (empty directory): /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f/refs/heads
Would remove (empty directory): /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f/refs
Would remove (empty directory): /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f/objects/info
$ brew cleanup
Pruned 0 symbolic links and 4 directories from /opt/homebrew
$ bundle update
Fetching http://bogomips.org/clogger.git
Retrying `git fetch --force --quiet --no-tags --depth 1 -- http://bogomips.org/clogger.git refs/heads/master:refs/heads/master` at /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f due to error (2/4): Bundler::Source::Git::GitCommandError Git error: command`git fetch --force --quiet --no-tags --depth 1 -- http://bogomips.org/clogger.git refs/heads/master:refs/heads/master`in directory /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f has failed.
fatal: refusing to fetch into branch 'refs/heads/master' checked out at '/opt/homebrew'
Retrying `git fetch --force --quiet --no-tags --depth 1 -- http://bogomips.org/clogger.git refs/heads/master:refs/heads/master` at /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f due to error (3/4): Bundler::Source::Git::GitCommandError Git error: command`git fetch --force --quiet --no-tags --depth 1 -- http://bogomips.org/clogger.git refs/heads/master:refs/heads/master`in directory /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f has failed.
fatal: refusing to fetch into branch 'refs/heads/master' checked out at '/opt/homebrew'
Retrying `git fetch --force --quiet --no-tags --depth 1 -- http://bogomips.org/clogger.git refs/heads/master:refs/heads/master` at /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f due to error (4/4): Bundler::Source::Git::GitCommandError Git error: command`git fetch --force --quiet --no-tags --depth 1 -- http://bogomips.org/clogger.git refs/heads/master:refs/heads/master`in directory /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f has failed.
fatal: refusing to fetch into branch 'refs/heads/master' checked out at '/opt/homebrew'
Git error: command`git fetch --force --quiet --no-tags --depth 1 -- http://bogomips.org/clogger.git refs/heads/master:refs/heads/master`in directory /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f has failed.
fatal: refusing to fetch into branch 'refs/heads/master' checked out at '/opt/homebrew'
The fix is to manually delete the directory at /opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f and then run bundle update again.
I don't know the best fix for this problem, but maybe brew cleanup shouldn't mess with the ruby gems directory at all? Or maybe check that the empty directories do not belong to bare git repository?
Or maybe check that the empty directories do not belong to bare git repository?
This seems reasonable.
That said: we should probably configure our Rubies/Bundlers to set BUNDLE_PATH: "vendor/ruby" and maybe BUNDLE_DISABLE_SHARED_GEMS: "true" by default. Installing to the Homebrew prefix should be avoided for reasons exactly like this.
brew doctor
outputVerification
brew doctor
output" above saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
twice and am still able to reproduce my issue.brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.brew config
outputWhat were you trying to do (and why)?
I have a ruby project with a Gemfile that sources a gem from a git source. When I run
bundle update
to check for gem updates, this particular gem has been having issues, seemingly randomly. Today I figured out that this issue happens afterbrew cleanup
has been run.What happened (include all command output)?
At this point, everything is working just fine. Here's how to break it:
The fix is to manually delete the directory at
/opt/homebrew/lib/ruby/gems/3.3.0/cache/bundler/git/clogger-b0c912e9759a20a9c2aa868294b5d44dfbaf537f
and then runbundle update
again.I don't know the best fix for this problem, but maybe
brew cleanup
shouldn't mess with the ruby gems directory at all? Or maybe check that the empty directories do not belong to bare git repository?What did you expect to happen?
I expect
brew cleanup
to not breakbundle update
.Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: