-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
brew ignores HOMEBREW_* variables #668
Comments
https://github.com/Homebrew/brew/blob/ad13524bcc50c145cc7d3c70dd4d2cff5d16d231/bin/brew#L42-L44 |
Yes that's what I gathered, but why? |
What's even the use of the environment variables if brew ignores them and recalculates its path each time ?? |
In ln -s "${HOMEBREW_PREFIX}" /path/to/prefixA
ln -s "${HOMEBREW_PREFIX}" /path/to/prefixB If we resolve brew install ...
$(realpath $(which brew)) install ...
/path/to/prefixA/bin/brew install ...
/path/to/prefixB/bin/brew install ...
Inside
|
I think you can mount Moreover, maybe it's fine to use if [[ -n "${HOMEBREW_LINUX}" ]]
then
HOMEBREW_DEFAULT_PREIFX="/home/linuxbrew/.linuxbrew"
if [[ "$(realpath "${HOMEBREW_BREW_FILE}")" == "$(${HOMEBREW_DEFAULT_PREIFX}/bin/brew)" ]]
then
HOMEBREW_PREIFX="${HOMEBREW_DEFAULT_PREIFX}"
else
HOMEBREW_PREFIX="${HOMEBREW_BREW_FILE%/*/*}"
fi
fi On macOS, we should not allow this. Any thoughts? |
So what ? you have several paths to
Good, but it doesn't help.
I'd like to ask again: why is it done so ? What is the use of environment variables if you can't override them? |
No. This is long-running behaviour that Homebrew on macOS on Intel has relied on for many years. If we change this on Linux: we will break existing configurations. We would consider a new environment variable to adjust this behaviour for cases like yours.
Internal implementation details.
This workaround seems preferable to changing Homebrew, though.
They are not documented as configurable. How and why Homebrew uses them internally is not really relevant here. |
And then the miracle happened:
It seems I now have a fully functional Homebrew on DSM!
That would still be useful. I'm not sure bind mount is a viable option for everyone. Also, in addition to the bind mount I had to do a little trick to complete the initial install, as follows: DSM does have a supported version of glibc, but it doesn't have the We are actually this close to having Homebrew install out of the box on DSM. Where do we go from here? |
I'm not sure. I'm unsure if it's worth making changes in Homebrew for things that one person has asked for but: it depends what those changes are. I think you'll need to be the one submitting/proposing those changes in PRs, though. |
Fine with me. DSM really needs an easy to install and state-of-the-art command line package manager, and the only alternative (Entware/opkg) is not that sexy. Meanwhile I have published my findings on the Synology forum so that it could benefit others: https://community.synology.com/enu/forum/1/post/153781 I might be the only to have asked here, but there has been some interest for Linuxbrew on DSM e.g. Linuxbrew/brew#893 |
install
oruninstall
script?brew config
andbrew doctor
and included their output with your issue? If you couldn't install: provided your OS version with the output of your issue?What you were trying to do (and why)
I have installed Homebrew on a Synology NAS (I had to cheat a little bit with glibc check but that's not the point here).
As the home directories on DSM are in
/var/services/homes
, I have a symbolic link/home -> /var/services/homes
, which itself resolves to/volume2/homes
on my NAS.What happened (include command output)
Although Homebrew is effectively installed in
/home/linuxbrew/.linuxbrew
, it insists that it is installed in/volume2/homes/linuxbrew/.linuxbrew
, which is bad because as you know it will compile stuff instead of using prebuilt binaries.I thought overriding the environment variables set by
brew shellenv
in~/.profile
would work, so instead ofeval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
I have explicitly defined all the variables that shellenv would set, replacing
/volume2/homes/linuxbrew
with/home/linuxbrew
:Unfortunately it doesn't change anything, as it seems the variables are ignored and brew always recomputes its real path...
So when I try to install gcc for example I get:
(I didn't let it finish)
So how can I force brew to use the prefix
/home/linuxbrew/.linuxbrew
??brew config
brew doctor
env
What you expected to happen
I expected the environment variables HOMEBREW_* that I set manually to override the computed values.
Or even better, that brew would realize that is is actually installed in
/home/linuxbrew/.linuxbrew
even though it's a link, and not complain...Step-by-step reproduction instructions (by running
brew
commands)See above
The text was updated successfully, but these errors were encountered: