Closed dkav closed 4 months ago
Why do you want this variable to be honoured?
That Homebrew uses Bundler should be seen as an implementation detail. This seems like a potentially small performance improvement for developer commands in exchange for a higher change of errors occurring with cache/Bundler issues.
I am not sure we are on the same page. Hopefully the following will add more clarity.
On macOS I have setup my shell environment to follow the XDG directory spec as much as possible. To have my preferences supported by Bundler I added the BUNDLER_USER_*
variables to my profile per Bundler's instructions. Using Bundler (installed via Homebrew's Ruby formula) directly I found that my defined paths were honored and the default ~/.bundler
folder was not created. However, outside my use of Bundler I found that the ~/.bundler
folder was being created and used by another tool. After a little testing, I found that Homebrew's use of Bundler was the source and only the ~/.bundler/cache
folder was being created.
So for me, supporting BUNDLER_USER_CACHE
would reduce some confusion and potentially support a user's existing preferences.
(I did try one quick attempt at implementing a solution but I was unsuccessful.)
After a little testing, I found that Homebrew's use of Bundler was the source and only the
~/.bundler/cache
folder was being created.
Was anything put in it/used from it? Ideally we'd avoid creating/using these sorts of directories in Homebrew at all. I agree with avoiding writing things to $HOME
is ideal if possible.
Yes. Standard looking compact_index
folder and contents.
Attached is directory listing after running the following:
brew install-bundler-gems --groups=
rm -frd ~/.bundle
brew install-bundler-gems --add-groups=bottle
ls -R ~/.bundle > ~/Downloads/ruby-cache-ls.txt
As a side note, after clearing Homebrew gems and then reinstalling the following error is consistently flagged.
Error loading RubyGems plugin "/opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/plugins/yard_plugin.rb": cannot load such file -- /opt/homebrew/Library/Homebrew/vendor/bundle/ruby/3.1.0/gems/yard-0.9.36/lib/rubygems_plugin.rb (LoadError)
Setting it unconditionally to HOMEBREW_CACHE/bundler
could make sense.
after clearing Homebrew gems
How are you clearing the gems?
How are you clearing the gems?
Via brew install-bundler-gems --groups=
I found the solution in a comment on GitHub. It wasn't clear to me how to do it otherwise.
Yeah that's the supported way. Will check why Bundler doesn't cleanup plugins.
Setting it unconditionally to
HOMEBREW_CACHE/bundler
could make sense.
Agreed. Should just be an environment variable to do so.
On my end #17304 doesn't resolve the issue. ~/bundle
reappears when running brew install-bundler-gems --add-groups=bottle
. No folder is created in ~/Library/Caches/Homebrew
, if that is the new location.
What's the output of brew config
and brew doctor
?
brew config
HOMEBREW_VERSION: 4.3.0-22-g56db99e ORIGIN: https://github.com/Homebrew/brew HEAD: 56db99ee9f3e47283c97b5471dac3178f58daf55 Last commit: 3 hours ago Core tap JSON: 15 May 16:39 UTC Core cask tap JSON: 15 May 16:39 UTC HOMEBREW_PREFIX: /opt/homebrew HOMEBREW_CASK_OPTS: [] HOMEBREW_CLEANUP_MAX_AGE_DAYS: 60 HOMEBREW_DEVELOPER: set HOMEBREW_EDITOR: /opt/homebrew/bin/mvim HOMEBREW_GITHUB_API_TOKEN: set HOMEBREW_MAKE_JOBS: 8 HOMEBREW_NO_EMOJI: set HOMEBREW_NO_ENV_HINTS: set HOMEBREW_NO_UPDATE_REPORT_NEW: 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_ibiza Clang: 15.0.0 build 1500 Git: 2.45.1 => /opt/homebrew/bin/git Curl: 8.6.0 => /usr/bin/curl macOS: 14.5-arm64 CLT: 15.3.0.0.1.1708646388 Xcode: N/A Rosetta 2: false
brew doctor
Your system is ready to brew.
~/bundle
reappears when runningbrew install-bundler-gems --add-groups=bottle
.
Do you have a ~/.bundle/config
?
Do you have a
~/.bundle/config
?
No. The following is my .zprofile
:
export BUNDLE_USER_CONFIG=$XDG_CONFIG_HOME/bundle/config
export BUNDLE_USER_PLUGIN=$XDG_DATA_HOME/bundle
export BUNDLE_USER_CACHE=$XDG_CACHE_HOME/bundle
Output frombundle config list
:
Settings are listed in order of priority. The top value will be used.
user_cache
Set via BUNDLE_USER_CACHE: "/Users/xxx/.cache/bundle"
user_config
Set via BUNDLE_USER_CONFIG: "/Users/xxx/.config/bundle/config"
user_plugin
Set via BUNDLE_USER_PLUGIN: "/Users/xxx/.local/share/bundle"
I don't have a config file so the config folder doesn't exist and is not created.
Verification
brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.Provide a detailed description of the proposed feature
Have Homebrew Bundler honor BUNDLE_USER_CACHE path variable if it has been set by the user.
What is the motivation for the feature?
When Homebrew installs or updates vendor gems it creates or uses the
./bundle/cache
directory ignoring BUNDLE_USER_CACHE variable set in the users environment. By the doing this it negates setting the variable in the first place.How will the feature be relevant to at least 90% of Homebrew users?
It will not be relevant.
What alternatives to the feature have been considered?
No alternatives have been considered.