9 ms·
To be fair, homebrew shouldn't need to change perms, it should follow common unix standards or at least fit in with OSX rather than require a hack. For years I'
by iuguy 11y ago
To be fair, homebrew shouldn't need to change perms, it should follow common unix standards or at least fit in with OSX rather than require a hack. For years I've felt homebrew should really use either /opt/ or ~/.homebrew/ by default.
- jrochkind1 11y agoWhat makes you think /usr/local isn't a 'common unix standard'?
- pjmlp 11y agoNever used Homebrew, but taking ownership of /user/local as I understand it does by default, certainly isn't a 'common unix standard'.
- baldfat 11y ago> certainly isn't a 'common unix standard' Here I google.com it for you. http://www.pathname.com/fhs/pub/fhs-2.3.html#THEUSRHIERARCHY http://www.pathname.com/fhs/pub/fhs-2.3.html#THEUSRHIERARCHY EDIT: Why is it okay to NOT look up a Standard and be uncertain in your comments when it can be found in 20 seconds tops on the Internet?
- dyladan 11y agoI don't see anywhere in there where it says you should take ownership of /usr/local
- baldfat 11y agoThat is why I said I searched and got the standard for the person who said "certainly it isn't the standard." We have the ultimate resource to know the answer to any question that does have an answer. I gave this down voted "I googled it for you" because people need to just look up what the Standard is and than speak from a position of knowledge and not some vague non-answer. For the still lazy the Unix File Hierarchy Standard for /usr /usr is the second major section of the filesystem. /usr is shareable, read-only data. That means that /usr should be shareable between various FHS-compliant hosts and must not be written to. Any information that is host-specific or varies with time is stored elsewhere. Large software packages must not use a direct subdirectory under the /usr hierarchy.
- pjmlp 11y agoYou are being downvoted because it is a GNU/Linux specific standard, not something that has been adopted by the UNIX standard, POSIX. And no, I am not the one downvoting you.
- baldfat 11y agoWell I feel like an idiot since I absolutely know that but when I was searching I was looking at Unix with no /usr and than went brain dead and thought it was showing /usr as a Linux issue with no standard for /usr. Thank you for correcting me..
- jrochkind1 11y agoConfusingly, it also says: > The /usr/local hierarchy is for use by the system administrator when installing software locally. It needs to be safe from being overwritten when the system software is updated. It may be used for programs and data that are shareable amongst a group of hosts, but not found in /usr. > Locally installed software must be placed within /usr/local rather than /usr unless it is being installed to replace or upgrade software in /usr. http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHIERARCHY http://www.pathname.com/fhs/pub/fhs-2.3.html#USRLOCALLOCALHI... It says "The /usr/local hierarchy is for use by the system administrator when installing software locally." That seems to kind of conflict with what you quoted "Large software packages must not use a direct subdirectory under the /usr hierarchy.", unless they mean a vendor-specific directory rather than "/usr/local". I dunno, all I can say is that in my experience on various unixes, it is a "common unix standard" to install software that is not controlled by the OS package manager to /usr/local. I don't interpret "common unix standard" as "FHS" though -- if you mean FHS, say FHS. To me "common unix standard" just means "something that is commonly done on unix". And installing locally-installed (not using OS distro) software to /usr/local is pretty commonly done, as many people can attest. That's why homebrew chose it, they didn't just make it up.
- deleted 11y ago[deleted]
- pjmlp 11y agoFilesystem Hierarchy Standard is a GNU/Linux standard. 'common unix standard' is whatever POSIX states as standard.
- deleted 11y ago[deleted]
- sambe 11y agoIt doesn't take ownership by default IIRC - just recommends that you do so. It will work with sudo if you want to go that way.
- snowwrestler 11y agoI run my Mac with a non-admin account. When I want to install or update Homebrew applications, I su to my admin account and use sudo. Just checked my /usr/local and it's owned by root. I've never had a problem running Homebrew apps from my non-admin account.
- OJFord 11y agoThis sounds like the best suggestion/solution in this thread. But if you run brew from admin, why can't admin take ownership , and run brew without sudo?
- snowwrestler 11y agoSo that Homebrew always requires my password to install an app, just like native OS X installs. It also preserves the default permissions. And it's not that hard to sudo.
- OJFord 11y ago> Homebrew always requires my password to install an app But isn't that _less_ safe? Instead of trusting Homebrew with /usr/local, you have to trust every formula with `sudo`? Or does it only use sudo for part of it, a `mv` or something?
- mzs 11y agoThat's very clever. There is one problem though, now make clean all install is run as root (well maybe install stages now in homebrew). Imagine an env var not set (the way make vars interact give lots of way to shoot off a big toe here) and the wrong dir gets rm_-rf_-ed or it obliterates something in /bin instead. If you don't run brew as root you at least protect places like /usr/lib, but you are protected from that and more with macports (where stages and uses nobody). But for now your approach seems the best pragmatic course to take, thank you for the suggestion.
- iuguy 11y agoAs I can't edit the comment, I wasn't referring to the name /usr/local as much as the permissions. It'd make more sense to store systemwide hierarchy in /opt/homebrew/* and user-specific hierarchy in ~/.homebrew/* instead.
- jrochkind1 11y agoMany unix tools are written to build looking for dependencies on default paths including /usr/local. Putting packages installed in a custom /opt/homebrew location would make it harder to install and use software that often assumes a /usr/local possibility, but not an /opt/homebrew it's never heard of. It is in fact a pretty common place to put non-distro installed software. And was not (and still is not?) used by OSX out of the box. It made a lot of sense for homebrew to use it.
- emanuelev 11y agoI can't think of anything more standard than /usr/local/.
- deong 11y agoMaking/assuming /usr/local is 0777 is definitely not though.
- baldfat 11y ago/usr should be Read Only http://www.pathname.com/fhs/pub/fhs-2.3.html#THEUSRHIERARCHY http://www.pathname.com/fhs/pub/fhs-2.3.html#THEUSRHIERARCHY
- emocakes 11y ago/opt/local is more correct
- alayne 11y agoiuguy is not talking about use of /usr/local, but rather the fact that homebrew makes it owned by the user who installed homebrew with permissions so that the user can maintain homebrew packages without sudo. Usually /usr/local is owned by root.
- sigsergv 11y agoUnfortunately, /usr/local is a total mess now. There is no internal package management in os x so applications could (and do) overwrite files in /usr/local. These conflicts are very annoying sometimes.
- twic 11y ago/opt? MacPorts uses /opt/local.
- quesera 11y agoBSD and Linux use /usr/local, it's not universal. But /usr/local has never been writable by non-privileged users. Homebrew depends on that nonstandard and undesireable permissions model. Apple doesn't bend to accommodate an inappropriate use. Hombrew doesn't want to use a location that is outside the default PATH, and they don't want to install with proper permissions, so they purposefully misinterpret the "standard". Hijinks ensue, and people blame Apple, which is silly.
- sneak 11y ago"Fit in with OSX" is why I put it in ~/Library/Homebrew/. Obvs.
- OJFord 11y ago> it should follow common unix standards Isn't /usr/local? > or at least fit in with OSX It did - before now /usr/local was available unprivileged with ownership. > rather than require a hack It only needs that now, since requirements to "fit in with OSX" have changed. That's not Homebrew's fault - they need a fast solution. Kudos in my book for responding before it's a problem.
- tptacek 11y agoNo, /usr/local is normally 755 root:root (or whatever the effective equivalent is). Homebrew wants it to be 775 root:admin, so that users with the admin bit can write to it. That's not standard. People keep writing here as if El Cap removes /usr/local entirely. It does not. /usr/local is there by default. You only have to go into recovery mode if you've somehow removed it yourself.
- quesera 11y ago> Homebrew wants it to be 775 root:admin It's worse than that. Homebrew wants 775 $(whoami):admin.
- deleted 11y ago[deleted]
- mzs 11y agoquesera's reply points-out just how bad it is, but even for just 775 root:admin I would have to use sudo (plus edit the sudoers or /usr/bin/login -p first) anyway: $ /usr/bin/env -i /bin/sh -c \ 'id | grep -lw admin >/dev/null && echo admin || echo non-admin' non-admin The problem is I have no problem using sudo, but homebrew does (like it wants make all to happen as me).
- OJFord 11y agoYeah, the more I read this thread, the more I'm thinking "why is that?" - `apt-get` et al have no problem with you using sudo, why does `brew` scare you into an alternative? 'because Mac'?
- isnotchicago 11y agoIf I have already installed a bunch of packages, how do I move everything to something like ~/.homebrew? (1) Change the HOMEBREW_PREFIX (2) move the existing aliases from /usr/local/bin (3) add the directory to my path (4) ???