Homebrew / homebrew-cask

🍻 A CLI workflow for the administration of macOS applications distributed as binaries
https://brew.sh
BSD 2-Clause "Simplified" License
20.95k stars 10.73k forks source link

SourceTree cask install fails #14173

Closed kenahoo closed 9 years ago

kenahoo commented 9 years ago

I just tried to install the sourcetree cask, but it failed like so:

% brew cask install sourcetree
==> Caveats
Cask sourcetree installs files under "/usr/local".  The presence of such
files can cause warnings when running "brew doctor", which is considered
to be a bug in homebrew-cask.

==> Downloading https://downloads.atlassian.com/software/sourcetree/SourceTree_2.0.5.3.dmg
######################################################################## 100.0%
==> Symlinking App 'SourceTree.app' to '/Users/kwilliams/Applications/SourceTree.app'
==> Symlinking Binary 'stree' to '/usr/local/bin/stree'
==> ln: /usr/local/bin/stree: Permission denied
Error: Command failed to execute!

==> Failed command:
["/bin/ln", "-hfs", "--", "#<Pathname:/opt/homebrew-cask/Caskroom/sourcetree/2.0.5.3/SourceTree.app/Contents/Resources/stree>", "#<Pathname:/usr/local/bin/stree>"]

==> Output of failed command:

==> Exit status of failed command:
#<Process::Status: pid 19502 exit 1>

Looks like a permissions issue, does the installer need to run with higher privileges?

My version:

% brew --version
0.9.5 (git revision 407c6; last commit 2015-10-01)
dardo82 commented 9 years ago

This looks like a duplicate of https://github.com/caskroom/homebrew-cask/issues/7750.

kenahoo commented 9 years ago

I'm not at this machine anymore and won't be again until Monday, but I do know I installed some non-brew packages, notably LaTeX stuff like MacTeX, and perhaps that screwed around with permissions on /usr/local.

dardo82 commented 9 years ago

Then check it out and don't forget to close this issue if you find out it's not homebrew-cask's fault.

adidalal commented 9 years ago

Not a problem here, I'm on 10.11. Make sure you run brew doctor and fix permissions as it asks.

See: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/El_Capitan_and_Homebrew.md


[~] > brew cask install sourcetree
==> Caveats
Cask sourcetree installs files under "/usr/local".  The presence of such
files can cause warnings when running "brew doctor", which is considered
to be a bug in homebrew-cask.

==> Downloading https://downloads.atlassian.com/software/sourcetree/SourceTree_2
######################################################################## 100.0%
==> Symlinking App 'SourceTree.app' to '/Applications/SourceTree.app'
==> Symlinking Binary 'stree' to '/usr/local/bin/stree'
🍺  sourcetree staged at '/opt/homebrew-cask/Caskroom/sourcetree/2.0.5.3' (2251 files, 113M)
[~] > 
kenahoo commented 9 years ago

@adidalal - I'm sure it's not sourcetree's fault, but I'm not sure where to direct blame. Any suggestions for figuring out whether MacTeX is messing things up, without getting a fresh machine (which I don't have) & installing again?

dardo82 commented 9 years ago

Could you virtualize the the fresh machine?

adidalal commented 9 years ago

@kenahoo Run brew doctor and check the output, you'll need to sudo chown -R $(whoami):admin /usr/local to fix permissions after upgrading (it'll tell you in the output)

kenahoo commented 9 years ago

I should clarify - I do know it's a permissions problem on directories in /usr/local, and how to fix it (I prefer doing sudo chown root:admin /usr/local/{bin,share,man,man/man1} and sudo chmod g+w /usr/local/{bin,share,man,man/man1}, because I don't want those directories owned by my personal user), but I don't know how they got their permissions changed.

My brew doctor now looks like this: https://gist.github.com/kenahoo/e5a39fe38ce627f3ac98 .

So I'm confident it's not sourcetree's fault, but I suspect it's some other package that's not playing well with homebrew - MacTeX comes to mind just because I did install it recently, using brew cask install mactex, which gave me /opt/homebrew-cask/Caskroom/mactex/20150613/mactex-20150613.pkg . I'd like to figure out whether that's being naughty.

kenahoo commented 9 years ago

I ran a 'verify' on the MacTeX package (after fixing the permissions on a small handful of directories to make homebrew happy) and got some output: https://gist.github.com/kenahoo/a0d2c48d60b1f22a0c70

So it seems confirmed that the mactex cask is messing up permissions for the rest of homebrew, right? Should the cask try to clean up after itself after installing?

adidalal commented 9 years ago

See https://www.tug.org/mactex/elcapitan.html

Looks like you may have to manually follow this once to upgrade your symlinks, but it shouldn't be a problem with a fresh install.

Alternatively, see if brew uninstall mactex and then following the uninstall guide, and finally reinstalling fixes things. (It should, there's nothing in the cask which should cause a problem afaik)

kenahoo commented 9 years ago

I don't have El Capitan installed, I'm still on Yosemite. Would any of this manifest on Yosemite?

kenahoo commented 9 years ago

@adidalal When you say "there's nothing in the cask which should cause a problem" - what's that based on? Unless I'm interpreting it wrong, it seems like the org.tug.mactex.texlive2015 bundle, which the mactex cask installs, makes some permissions changes that are incompatible with Homebrew.

adidalal commented 9 years ago

According to this StackOverflow post that is not the case - only usr/local/texlive is touched by the installer (and your $PATH, it seems)

adidalal commented 9 years ago

@kenahoo any update?

Regardless, it looks like if there any issues, it'd be with the mactex cask, not sourcetree cask - and I get no errors with a clean install of either formula, for what it's worth

vitorgalvao commented 9 years ago

No further reply and this seems to be have affected only one user, so closing.