permissions denied running brew cask install <app_name> after fresh cask install
patkaehuaea opened this issue · 2 comments
Cookbook version
2.1.2
Chef-client version
Chef: 12.14.89
Platform Details
OS X El Capitan Version 10.11.6
Scenario:
TLDR: /usr/local/bin/brew cask install atom is failing because it doesn't have permissions to ~/Library/Caches/Homebrew/Cask/atom
I'm running Nordstrom/chefdk_bootstrap. One of the steps is to run the homebrew::cask recipe:
Recipe: homebrew::cask
* homebrew_tap[caskroom/cask] action tap
* execute[tapping caskroom/cask] action run (skipped due to not_if)
(up to date)
* directory[/Library/Caches/Homebrew/Casks] action create (skipped due to only_if)
The install succeeds, but subsequent calls to /usr/local/bin/brew cask install <app_name> fail:
$ /usr/local/bin/brew cask install atom
==> Satisfying dependencies
complete
==> Downloading https://github.com/atom/atom/releases/download/v1.11.1/atom-mac.zip
Error: Download failed on Cask 'atom' with message: Permission denied - /Users/pkaehuae/Library/Caches/Homebrew/Cask/atom--1.11.1.zip.incomplete
The workaround is to:
$ sudo chown -R $USER ~/Library/Caches/Homebrew/
While this remediates the issue, I feel like a better fix would be to add a block similar to the one below, but for ~/Library/Caches/Homebrew/ in addition to the one listed:
https://github.com/chef-cookbooks/homebrew/blob/master/recipes/cask.rb#L23-L27
Steps to Reproduce:
- Run this line https://github.com/Nordstrom/chefdk_bootstrap/blob/master/recipes/mac_os_x.rb#L29 on a system that does not have Homebrew or Cask installed.
- Run
/usr/local/bin/brew cask install atom
. - Verify error
Error: Download failed on Cask 'atom' with message: Permission denied - /Users/pkaehuae/Library/Caches/Homebrew/Cask/atom--1.11.1.zip.incomplete
- Run
sudo chown -R $USER ~/Library/Caches/Homebrew/
- Attempt atom install again:
/usr/local/bin/brew cask install atom
- Verify success.
Expected Result:
This is successful: /usr/local/bin/brew cask install atom
Actual Result:
Error: Download failed on Cask 'atom' with message: Permission denied - /Users/pkaehuae/Library/Caches/Homebrew/Cask/atom--1.11.1.zip.incomplete
I've heard a second report of this in the wild
I believe we've fixed this in the 4.0 release. Give it a try and feel free to open this back up if you're still seeing the issue