Is it time to default HOMEBREW_PREFIX and warnings around it? #3339
-
TL;DR; Is it time to reconcider the fixed homebrew prefix? Homebrew seems to be strongly worded around keeping a standard prefix for where homebrew is installed. The understanding is that some bottles are hardcoded (or perhaps require to have a standard prefix?) and it seems that changing of this prefix or installing into a custom directory is unsupported and the effort is 100% on the user. However there seems to already be exceptions to this: ARM macs has moved to /opt while Intel is /usr/local/opt. Also on Linux the use of a directory in /home is bad practice and against LFS standards. There are new services like systemd-homed which is an effort to manage /home outside of a filesystem and won't work with this prefix: https://systemd.io/HOME_DIRECTORY/ Perhaps with the recent changes now is the opportunity to start fixing the reason for these static prefix definitions and do one of the two options.:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Those are the respective standard prefixes for those platforms and get CI and fixes for them.
But it is the primary use case for Homebrew on Linux: "I do not have root permissions but want to install newer tools" in which case any other directory will be near impossible to use.
It's already allowed, it's just a bad idea and you'll have to fix any issues you find by yourself.
That will break the usecase for which homebrew on Linux was created so that's unlikely to happen. |
Beta Was this translation helpful? Give feedback.
-
I have read in some places that it seems like installing the standard way with sudo into /home/linuxbrew allows you after to possibly move that folder anywhere you like after the fact and brew still works with precompiled binaries as long as you set the prefix variable correctly. This link made me realize that you could simulate this with unshare linux cli utility to basically lie and tell brew up is down. https://unix.stackexchange.com/questions/237636/is-it-possible-to-fake-a-specific-path-for-a-process But why is this necessary? Docs go to great pains to point out how secure brew is and that it doesn’t use sudo except for creating this super special folder. They won’t even let you run the script as sudo or root, but only prompt you for the password for that one command. So let me just humbly say, this is really stupid. It removes one of the most valuable use cases for brew, the common situation where you are doing dev or debugging in a corporate environment that does not allow sudo. There should be interest in a non sudo install in user land. |
Beta Was this translation helpful? Give feedback.
It's not an easy problem to solve.
The problem is simply this: some software bake in install paths at build-time and thus many pre-built bottles won't work and you will have to install things from source. It's for this reason that we warn. Homebrew itself does support non-default prefixes and likely always will but we warn you it's not a good idea because installing packages by building from source takes significantly longer (i.e. potentially hours rather than seconds) and has a substantially increased error rate. The warnings are there to make sure you are aware that the user experience isn't as good and may be more likely to break rather than innocently picking an option without knowing…