Skip to content

Bug: initial brew bundle dump --global ignores XDG_CONFIG_HOME #20628

@texastoland

Description

@texastoland

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: You are using macOS 26.
We do not provide support for this pre-release version.

This is a Tier 2 configuration:
  https://docs.brew.sh/Support-Tiers#tier-2
You can report Tier 2 unrelated issues to Homebrew/* repositories!
Read the above document instead before opening any issues or PRs.

Verification

brew config output

HOMEBREW_VERSION: 4.6.8
ORIGIN: https://github.com/Homebrew/brew
HEAD: 9da27e1ac280ce720dfcbe6d5dac0dab2dcfc508
Last commit: 24 hours ago
Branch: stable
Core tap JSON: 03 Sep 08:03 UTC
Core cask tap JSON: 03 Sep 08:03 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: edit
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.4.5 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.5/bin/ruby
CPU: deca-core 64-bit arm_firestorm_icestorm
Clang: 17.0.0 build 1700
Git: 2.50.1 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.0-arm64
CLT: 26.0.0.0.1.1755155385
Xcode: N/A
Rosetta 2: false

What were you trying to do (and why)?

brew bundle dump --global

What happened (include all command output)?

Successfully creates a new $HOME/.Brewfile.

What did you expect to happen?

Creates $XDG_CONFIG_HOME/homebrew/Brewfile (defined in my .zprofile).

Step-by-step reproduction instructions (by running brew commands)

The issue (bug?) appears to be the following code requires a Brewfile already exists:

if user_config_home && File.exist?("#{user_config_home}/Brewfile")
"#{user_config_home}/Brewfile"
else
Bundle.exchange_uid_if_needed! do
"#{Dir.home}/.Brewfile"
end
end

Where I assume:

user_config_home = ENV.fetch("HOMEBREW_USER_CONFIG_HOME", nil)

Comes from:

brew/bin/brew

Lines 152 to 157 in ab980dc

if [[ -n "${XDG_CONFIG_HOME-}" ]]
then
HOMEBREW_USER_CONFIG_HOME="${XDG_CONFIG_HOME}/homebrew"
else
HOMEBREW_USER_CONFIG_HOME="${HOME}/.homebrew"
fi

I'm not sure what the fix should be. If either environment variable was explicitly defined I'd expect it to be used or else follow the current behavior. Alternatively checking for the existence of $HOMEBREW_USER_CONFIG_HOME would be preferable to the Brewfile itself.

Metadata

Metadata

Assignees

Labels

help wantedWe want help addressing this

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions