Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
41.3k stars 9.71k forks source link

Homebrew puts project-specific text files in /usr/local #391

Closed systemed closed 8 years ago

systemed commented 8 years ago

I'm seeing CODEOFCONDUCT.md, LICENSE.txt and README.md files in my /usr/local directory.

The root of /usr/local isn't an appropriate place for these files, and it's a bit misleading as there are of course other, non-Homebrewed files within the tree to which this licence/code don't apply.

Homebrew 0.9.9, freshly brew updated, OS X 10.11.4.

MikeMcQuaid commented 8 years ago

The root of /usr/local isn't an appropriate place for these files, and it's a bit misleading as there are of course other, non-Homebrewed files within the tree to which this licence/code don't apply.

If /usr/local is where you have installed Homebrew it's expected that these live in the root of where you've installed Homebrew. This has been where we've installed these files since the beginning of the project and, as the the Git root directory, that's very unlikely to change.

systemed commented 8 years ago

Hm. Not ideal but...

As best you know, do the instructions for 'relocating' Homebrew at https://gist.github.com/danmactough/96ccf7a51e733173894e/revisions still hold true?

MikeMcQuaid commented 8 years ago

No, that won't work consistently. The best way is to use brew bundle dump and brew bundle to dump and reinstall your packages list. It's also worth noting that many of our binary packages are only built for /usr/local.

systemed commented 8 years ago

Ok, thanks. I'll chalk this one up to "mildly annoying but unfixable" then. ;) Thanks for the explanations.

chdiza commented 8 years ago

@systemed I too am annoyed by this. Here is how I get around it:

(1) Pick some place else for HB internals to go, e.g., ~/foo. (2) Git clone the brew repo to there. (3) Manually symlink the brew binary, the brew man page, and the share/doc/homebrew dirs into the corresponding places in /usr/local. (4) the KEY STEP is to create an empty dir called /usr/local/Cellar before you try installing anything. (5) Do brew tap Homebrew/homebrew-core. (6) Do brew doctor just to make sure things are sane.

This way, HB will still have the Cellar under /usr/local, which means you can still take advantage of any bottles that aren't relocatable, and won't have problems with the odd formula that hardcodes something with /usr/local. But, since all the HB stuff is tucked away in ~/foo, you aren't forced to look at HB detritus in /usr/local.

If you skip step (4), HB will auto-create a Cellar under ~/foo. This will work, but you won't be able to pour some bottles (the ones that aren't relocatable).

The whole process mentioned above is easily bash-scriptable if you want an unattended install.

MikeMcQuaid commented 8 years ago

@chdiza Have you found any issues or bottles that fail with this approach?

chdiza commented 8 years ago

@MikeMcQuaid None at all. The only minor headache was creating a custom bash script to automatically carry out the described procedure.

MikeMcQuaid commented 8 years ago

@chdiza is it online somewhere we could see?

chdiza commented 8 years ago

is it online somewhere we could see?

It is now.

The "minor headache" was from my lack of bash skills, not the core of the procedure.

MikeMcQuaid commented 8 years ago

@chdiza Thanks!