Homebrew-cask: Bug report: Permission denied Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX

Created on 20 Sep 2016  Â·  4Comments  Â·  Source: Homebrew/homebrew-cask

Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX

I initially discovered my error when trying to install the cask Caskroom/cask/vagrant.
Upon following the instructions to attempt a repair and all the instructions from your git project, I discovered I have a more general permissions issue.

This command brew cleanup; brew cask cleanup; brew update, which I ran following these commands:

cd $(brew --repo); git fetch; git reset --hard origin/master brew untap phinze/cask; brew untap caskroom/cask; brew uninstall --force brew-cask

per the guide, produce this error:

Error of brew cleanup; brew cask cleanup; brew update in gist

When I try to install the vagrant cask I get the same error:

Error of brew install Caskroom/cask/vagrant in gist

My user who is a member of the admin group has these permissions for /usr/local/Homebrew/Caskroom :

/usr/local/Homebrew/Caskroom Permissions in gist

My user has these permissions for /Applications:
drwxrwxr-x+ 80 root admin 2.8K Sep 19 12:11 Applications

Output of brew cask install Caskroom/cask/vagrant --verbose

$ brew cask install Caskroom/cask/vagrant --verbose
==> Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX
Error: Permission denied - (/usr/local/Homebrew/Caskroom, /usr/local/Caskroom)Most likely, this means you have an outdated version of Homebrew-Cask. Please run:

    brew uninstall --force brew-cask; brew untap phinze/cask; brew untap caskroom/cask; brew update; brew cleanup; brew cask cleanup

If this doesn’t fix the problem, please report this bug:

    https://github.com/caskroom/homebrew-cask#reporting-bugs

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:519:in `rename'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:519:in `block in mv'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1558:in `block in fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1574:in `fu_each_src_dest0'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:1556:in `fu_each_src_dest'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/fileutils.rb:508:in `mv'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/caskroom.rb:8:in `migrate_caskroom_from_repo_to_prefix'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc.rb:52:in `init'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:146:in `process'
/usr/local/Homebrew/Library/Homebrew/cask/cmd/brew-cask.rb:8:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/usr/local/Homebrew/Library/Homebrew/brew.rb:23:in `require?'
/usr/local/Homebrew/Library/Homebrew/brew.rb:105:in `<main>'
Error: Kernel.exit

Output of brew doctor

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: The filesystem on / appears to be case-sensitive.
The default macOS filesystem is case-insensitive. Please report any apparent problems.

Output of brew cask doctor

$ brew cask doctor
==> macOS Release:
10.11.6
==> Hardware Architecture:
intel-64
==> Ruby Version:
2.0.0-p648
==> Ruby Path:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
==> Homebrew Version:
Homebrew 0.9.9 (git revision e2261; last commit 2016-09-19)
Homebrew/homebrew-core (git revision 5c50; last commit 2016-09-19)
==> Homebrew Executable Path:
/usr/local/bin/brew
==> Homebrew Cellar Path:
/usr/local/Cellar
==> Homebrew Repository Path:
/usr/local/Homebrew
==> Homebrew Origin:
https://github.com/Homebrew/brew
==> Homebrew-Cask Version:
0.60.0 (git revision ebc8; last commit 71 minutes ago)
==> Homebrew-Cask Install Location:
<NONE>
==> Homebrew-Cask Staging Location:
/usr/local/Caskroom (error: path does not exist)}
==> Homebrew-Cask Cached Downloads:
/Users/dresdem/Library/Caches/Homebrew/Cask
7 files, 398.4M (warning: run "brew cask cleanup")
==> Homebrew-Cask Default Tap Path:
/usr/local/Homebrew/Library/Taps/caskroom/homebrew-cask
==> Homebrew-Cask Alternate Cask Taps:
==> Homebrew-Cask Default Tap Cask Count:
3312
==> Contents of $LOAD_PATH:
/usr/local/Homebrew/Library/Homebrew/cask/lib
/usr/local/Homebrew/Library/Homebrew
/Library/Ruby/Site/2.0.0
/Library/Ruby/Site/2.0.0/x86_64-darwin15
/Library/Ruby/Site/2.0.0/universal-darwin15
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin15
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin15
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin15
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin15
==> Contents of $RUBYLIB Environment Variable:
<NONE>
==> Contents of $RUBYOPT Environment Variable:
<NONE>
==> Contents of $RUBYPATH Environment Variable:
<NONE>
==> Contents of $RBENV_VERSION Environment Variable:
<NONE>
==> Contents of $CHRUBY_VERSION Environment Variable:
<NONE>
==> Contents of $GEM_HOME Environment Variable:
<NONE>
==> Contents of $GEM_PATH Environment Variable:
<NONE>
==> Contents of $BUNDLE_PATH Environment Variable:
<NONE>
==> Contents of $PATH Environment Variable:
PATH="/Users/dresdem/.rbenv/shims:~/.rbenv/bin:/usr/lib/qt-3.3/bin:/usr/lib64/ccache:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/Homebrew/Library/Taps/homebrew/homebrew-services/cmd:/usr/local/Homebrew/Library/Homebrew/cask/cmd:/usr/local/Homebrew/Library/Homebrew/shims/scm"
==> Contents of $SHELL Environment Variable:
SHELL="/bin/bash"
==> Contents of Locale Environment Variables:
LANG="en_US.UTF-8"
==> Running As Privileged User:
No

I have no brew cask environment variables set

So I saw in the error its looking at two cask locations:
/usr/local/Homebrew/Caskroom
/usr/local/Caskroom

Up until at least 3 days ago it was working fine from /usr/local/Homebrew/Caskroom

The 2nd path did not exist, so I created that and all the errors are resolved, but now I will have some cask file at the first path and newer installed ones at the second path.

Is this expected? If it is intended that all new cask moving forward belong in the 2nd path should I in any migrate one from the first path to the 2nd path?

Most helpful comment

same here... but there's an easier solution.

so, clearly Homebrew and Hombrew-Cask are having a miscommunication about where things should live and what the ownership should be.

leewalsh@warbler ~> brew update
Updated Homebrew from 8e9a9b6 to 13f08a2.
Updated 3 taps (caskroom/cask, homebrew/core, homebrew/science).
==> Updated Formulae
git-town                mg3a                    proof-general
languagetool            pkg-config âś”
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local

interesting...

leewalsh@warbler ~> brew --prefix
/usr/local
leewalsh@warbler ~> brew --repo
/usr/local/Homebrew

ok, sure, I'll do it:

leewalsh@warbler ~> sudo chown root:wheel /usr/local

uhoh homebrew-cask says

NO I wanna go back to /usr/local!

leewalsh@warbler ~> brew cask cleanup
==> Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX
Error: Permission denied - (/usr/local/Homebrew/Caskroom, /usr/local/Caskroom)
Most likely, this means you have an outdated version of Homebrew-Cask. Please run:

    brew uninstall --force brew-cask; brew untap phinze/cask; brew untap caskroom/cask; brew update; brew cleanup; brew cask cleanup

If this doesn’t fix the problem, please report this bug:

    https://github.com/caskroom/homebrew-cask#reporting-bugs

I think this is the 100th time I've been told to untap phinze/cask ... of course it won't fix the problem. this will:

leewalsh@warbler ~> sudo chown $USER:admin /usr/local

leewalsh@warbler ~> brew cask cleanup
==> Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX
==> Removing cached downloads
Nothing to do

leewalsh@warbler ~> sudo chown root:wheel /usr/local

and now there is only one Caskroom:

leewalsh@warbler ~> ll -d /usr/local/Caskroom /usr/local/Homebrew/Caskroom
ls: /usr/local/Homebrew/Caskroom: No such file or directory
drwxr-xr-x  43 leewalsh  admin   1.4K Sep 19 09:13 /usr/local/Caskroom/

🍻

All 4 comments

same here... but there's an easier solution.

so, clearly Homebrew and Hombrew-Cask are having a miscommunication about where things should live and what the ownership should be.

leewalsh@warbler ~> brew update
Updated Homebrew from 8e9a9b6 to 13f08a2.
Updated 3 taps (caskroom/cask, homebrew/core, homebrew/science).
==> Updated Formulae
git-town                mg3a                    proof-general
languagetool            pkg-config âś”
==> Migrating HOMEBREW_REPOSITORY (please wait)...
==> Migrated HOMEBREW_REPOSITORY to /usr/local/Homebrew!
Homebrew no longer needs to have ownership of /usr/local. If you wish you can
return /usr/local to its default ownership with:
  sudo chown root:wheel /usr/local

interesting...

leewalsh@warbler ~> brew --prefix
/usr/local
leewalsh@warbler ~> brew --repo
/usr/local/Homebrew

ok, sure, I'll do it:

leewalsh@warbler ~> sudo chown root:wheel /usr/local

uhoh homebrew-cask says

NO I wanna go back to /usr/local!

leewalsh@warbler ~> brew cask cleanup
==> Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX
Error: Permission denied - (/usr/local/Homebrew/Caskroom, /usr/local/Caskroom)
Most likely, this means you have an outdated version of Homebrew-Cask. Please run:

    brew uninstall --force brew-cask; brew untap phinze/cask; brew untap caskroom/cask; brew update; brew cleanup; brew cask cleanup

If this doesn’t fix the problem, please report this bug:

    https://github.com/caskroom/homebrew-cask#reporting-bugs

I think this is the 100th time I've been told to untap phinze/cask ... of course it won't fix the problem. this will:

leewalsh@warbler ~> sudo chown $USER:admin /usr/local

leewalsh@warbler ~> brew cask cleanup
==> Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX
==> Removing cached downloads
Nothing to do

leewalsh@warbler ~> sudo chown root:wheel /usr/local

and now there is only one Caskroom:

leewalsh@warbler ~> ll -d /usr/local/Caskroom /usr/local/Homebrew/Caskroom
ls: /usr/local/Homebrew/Caskroom: No such file or directory
drwxr-xr-x  43 leewalsh  admin   1.4K Sep 19 09:13 /usr/local/Caskroom/

🍻

@leewalsh
It works for me, thanks.

Sorry about the inconvenience. This is exactly as @leewalsh says and should only be a problem if you actually chown'd /usr/local back to root:wheel. If you run brew update now, the Caskroom won't be moved back and forth between /usr/local/Homebrew/Caskroom and /usr/local/Caskroom.

Same problem here Thanks @leewalsh

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gebing picture gebing  Â·  3Comments

akashlevy picture akashlevy  Â·  3Comments

arnogues picture arnogues  Â·  4Comments

pendolf picture pendolf  Â·  4Comments

dentarg picture dentarg  Â·  3Comments