Live data from Hacker News

El Capitan and Homebrew

github.com

31–40 of 298 posts

Re: El Capitan and Homebrew

#31
post #17

I'm curious to know if there's a reason everyone installs Homebrew in /usr/local (other than it being the default installation path). I've always chosen to install it in ~/.homebrew and haven't had any problems. Everything I install with Homebrew seems to handle an alternative prefix without issue.

brew supports pre-compiled binary packages (what they call bottles) only when you use the default install location /usr/local. If you use any other prefix brew will always compile all packages on your system, which might take a long time depending on the performance of your system. So using /usr/local saves time and energy since all brew needs to do is to download and install binary packages.

Re: El Capitan and Homebrew

#32
post #17

I'm curious to know if there's a reason everyone installs Homebrew in /usr/local (other than it being the default installation path). I've always chosen to install it in ~/.homebrew and haven't had any problems. Everything I install with Homebrew seems to handle an alternative prefix without issue.

That's a common Unix practice to put system-wide stuff manually managed (as opposed to managed by the OS/distribution) in /usr/local.

Yep, I agree and that's where I install stuff on everything other than OS X. One distinction though, I think, is that most of the stuff I install on OS X I don't want to be available system-wide. I'm (typically) not using Homebrew to install daemons that run all the time or things that serve critical system/network functions, so I've never seen a reason to make them available to the entire system. I agree that goes against the Unix way but I started preferring this way of using Homebrew after I had similar problems upgrading and even updating OS X.

Also, what if for some reason a single machine is shared by two people and they need different versions of some programs installed with Homebrew? Installing everything in /usr/local isn't going to look like a good idea then.

Re: El Capitan and Homebrew

#33
post #23
post #12

Earlier quoted context omitted.

Then install brew with sudo.

This is what you used to see when you tried to use sudo with brew: Error: Cowardly refusing to `sudo brew install` You can use brew with sudo, but only if the brew executable is owned by root. However, this is both not recommended and completely unsupported so do so at your own risk. I don't know if it's different now, but a quick Google search indicates that brew still behaves like this. I would like to use brew wit…

Yes it is still like this.

When XCode needed some license approval after the recent upgrade to support iOS9, Brew warned me that license can only be approved ( programatically ) by root. I tried to sudo brew and received the warning you showed. That was 1 week ago.

Re: El Capitan and Homebrew

#34
Couldn't all this be avoided if Homebrew installed itself in a sub-directory of /usr/local (e.g. /usr/local/homebrew) instead of /usr/local itself?

Edit: For the avoidance of any doubt/confusion, this is what a virgin /usr/local/ looks like after Homebrew has been installed:

  $ ls -la /usr/local
  total 96
  drwxrwxr-x  13 root      admin    442 31 Aug 21:52 .
  drwxr-xr-x@ 12 root      wheel    408 31 Aug 21:52 ..
  drwxr-xr-x  14 jgavigan  admin    476 31 Aug 21:52 .git
  -rw-r--r--   1 jgavigan  admin    448 31 Aug 21:52 .gitignore
  -rw-r--r--   1 jgavigan  admin    291 31 Aug 21:52 .yardopts
  -rw-r--r--   1 jgavigan  admin   3161 31 Aug 21:52 CODEOFCONDUCT.md
  -rw-r--r--   1 jgavigan  admin   1103 31 Aug 21:52 CONTRIBUTING.md
  -rw-r--r--   1 jgavigan  admin   1241 31 Aug 21:52 LICENSE.txt
  drwxr-xr-x   9 jgavigan  admin    306 31 Aug 21:52 Library
  -rw-r--r--   1 jgavigan  admin   2319 31 Aug 21:52 README.md
  -rw-r--r--   1 jgavigan  admin  23801 31 Aug 21:52 SUPPORTERS.md
  drwxr-xr-x   3 jgavigan  admin    102 31 Aug 21:52 bin
  drwxr-xr-x   4 jgavigan  admin    136 31 Aug 21:52 share

Re: El Capitan and Homebrew

#35
post #31
post #17

I'm curious to know if there's a reason everyone installs Homebrew in /usr/local (other than it being the default installation path). I've always chosen to install it in ~/.homebrew and haven't had any problems. Everything I install with Homebrew seems to handle an alternative prefix without issue.

brew supports pre-compiled binary packages (what they call bottles ) only when you use the default install location /usr/local. If you use any other prefix brew will always compile all packages on your system, which might take a long time depending on the performance of your system. So using /usr/local saves time and energy since all brew needs to do is to download and install binary packages.

Actually, many bottles are marked as safe to install anywhere, so even if you don't use /usr/local you will still get a lot of things installed via bottles (but not everything).

Re: El Capitan and Homebrew

#36
post #26
post #21

Earlier quoted context omitted.

Actually it sounds like you will need to run this/restore permissions after every future OS X update.

Hmm, having been on El Capitan since the first beta, this hasn't happened. Do you have anywhere it states that?

https://github.com/Homebrew/homebrew/blob/master/share/doc/h...

"Apple documentation hints that /usr/local will be returned to root:wheel restricted permissions on every OS X update; Homebrew will be adding a brew doctor check to warn you when this happens in the near future."

Re: El Capitan and Homebrew

#37
post #8
post #4

I just did this (from [1]): sudo chown -R $(whoami):admin /usr/local And not `sudo chown $(whoami):admin /usr/local`. Are both really necessary? [1]: https://news.ycombinator.com/item?id=10307800

The -R was a bit overkill - what's inside /usr/local should already have had the correct owner - the problem is the owner of /usr/local itself.

The upgrade changes the permissions of all files within /usr/local to root:wheel.

Re: El Capitan and Homebrew

#38
post #19
post #17

I'm curious to know if there's a reason everyone installs Homebrew in /usr/local (other than it being the default installation path). I've always chosen to install it in ~/.homebrew and haven't had any problems. Everything I install with Homebrew seems to handle an alternative prefix without issue.

Because it has never caused any trouble having it in /usr/local, and as another user said /usr/local/bin is part of the standard path. Other than this one-liner, which is done once, there really isn't any extra hassle with using the default. I'd be more interested in why you didn't want to install it there?

I installed mine in /usr/local/brew because I already had a ton of stuff in /usr/local managed with GNU stow before brew even existed. I don't have any problems with it.

Someone I know puts it in ~/brew and that works just fine, too. His reasoning is that /usr/local/ is for all users, and though he's really the only user on his laptop, it's just wrong to install a bunch of stuff that's just for him into a global user directory.

Re: El Capitan and Homebrew

#39
Is this also related to why you can't rename /usr/local to /usr/local.old? (To do a fresh install of homebrew into /usr/local.)

  $ sudo mv local local.old
  mv: rename local to local.old: Operation not permitted

Re: El Capitan and Homebrew

#40

Couldn't all this be avoided if Homebrew installed itself in a sub-directory of /usr/local (e.g. /usr/local/homebrew) instead of /usr/local itself? Edit: For the avoidance of any doubt/confusion, this is what a virgin /usr/local/ looks like after Homebrew has been installed: $ ls -la /usr/local total 96 drwxrwxr-x 13 root admin 442 31 Aug 21:52 . drwxr-xr-x@ 12 root wheel 408 31 Aug 21:52 .. drwxr-xr-x 14 jgavigan ad…

That would break the unix convention they are trying to follow, so then they might as well put it anywhere else as well.
Post reply on HN