homebrew-cask: Error: Permission denied

Description of issue

Every time I user brew cask install , I face the same issue. But I still can use brew install

Output of brew cask install filezilla --verbose

==> Downloading http://downloads.sourceforge.net/project/filezilla/FileZilla_Client/3.18.0/FileZilla_3.18.0_macosx-x86.app.tar.bz2
Already downloaded: /Users/jihan/Library/Caches/Homebrew/filezilla-3.18.0.tar.bz2
==> Verifying checksum for Cask filezilla
==> Moving App 'FileZilla.app' to '/Applications/FileZilla.app'
Error: Permission denied - (/usr/local/Caskroom/filezilla/3.18.0/FileZilla.app, /Applications/FileZilla.app)
  Most likely, this means you have an outdated version of homebrew-cask. Please run:

      brew uninstall --force brew-cask; brew untap phinze/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/Library/Taps/caskroom/homebrew-cask/lib/hbc/artifact/moved.rb:50:in `move'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/artifact/moved.rb:26:in `block in install_phase'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/artifact/moved.rb:43:in `block in each_artifact'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/artifact/moved.rb:42:in `each'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/artifact/moved.rb:42:in `each_artifact'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/artifact/moved.rb:22:in `install_phase'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/installer.rb:129:in `block in install_artifacts'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/installer.rb:126:in `each'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/installer.rb:126:in `install_artifacts'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/installer.rb:75:in `install'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/install.rb:21:in `block in install_casks'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/install.rb:18:in `each'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/install.rb:18:in `install_casks'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli/install.rb:7:in `run'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli.rb:83:in `run_command'
/usr/local/Library/Taps/caskroom/homebrew-cask/lib/hbc/cli.rb:121:in `process'
/usr/local/Library/Taps/caskroom/homebrew-cask/cmd/brew-cask.rb:26: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/Library/brew.rb:22:in `require?'
/usr/local/Library/brew.rb:93:in `<main>'
Error: Kernel.exit

Output of brew doctor

Your system is ready to brew.

Output of brew cask doctor

==> macOS Release:
10.11
==> macOS Release with Patchlevel:
10.11.5
==> 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 96cb; last commit 2016-06-17)
Homebrew/homebrew-core (git revision b1d0; last commit 2016-06-17)
==> Homebrew Executable Path:
/usr/local/bin/brew
==> Homebrew Cellar Path:
/usr/local/Cellar
==> Homebrew Repository Path:
/usr/local
==> Homebrew Origin:
https://github.com/Homebrew/brew
==> Homebrew-cask Version:
0.60.0 (git revision 51e2; last commit 29 minutes ago)
==> Homebrew-cask Install Location:
<NONE>
==> Homebrew-cask Staging Location:
/usr/local/Caskroom
==> Homebrew-cask Cached Downloads:
/Users/jihan/Library/Caches/Homebrew
/Users/jihan/Library/Caches/Homebrew/Casks
2 files, 14.6M (warning: run "brew cask cleanup")
==> Homebrew-cask Default Tap Path:
/usr/local/Library/Taps/caskroom/homebrew-cask
==> Homebrew-cask Alternate Cask Taps:
<NONE>
==> Homebrew-cask Default Tap Cask Count:
3211
==> Contents of $LOAD_PATH:
/usr/local/Library/Taps/caskroom/homebrew-cask/lib
/usr/local/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="/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Library/Taps/caskroom/homebrew-cask/cmd:/usr/local/Library/ENV/scm"
==> Contents of $SHELL Environment Variable:
SHELL="/bin/bash"
==> Contents of Locale Environment Variables:
LANG="en_US.UTF-8"
==> Running As Privileged User:
No

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 28 (15 by maintainers)

Most upvoted comments

It’s solved my problem sudo chown -R $(whoami):staff /Applications/

Thanks everyone…

I had the same error message:

Error: Permission denied - (/Users/jt3k/Library/Caches/Homebrew/black-screen-0.0.3.zip, /Users/jt3k/Library/Caches/Homebrew/Casks/black-screen-0.0.3.zip)

Following command fixed my problem.

sudo chown -R $(whoami):staff ~/Library/Caches/Homebrew /opt/homebrew-cask/

thanx

I was getting this:

$ brew cask reinstall xquartz
==> Migrating Caskroom from /opt/homebrew-cask/Caskroom to /usr/local/Caskroom.
Error: Permission denied - (/opt/homebrew-cask/Caskroom, /usr/local/Caskroom)
Follow the instructions here:
  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/compat/hbc/caskroom.rb:15:in `migrate_legacy_caskroom'
/usr/local/Homebrew/Library/Homebrew/compat/hbc.rb:15:in `init'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:167:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:132:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:8:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

and the fix was to

mkdir /usr/local/Caskroom

What if the current user is not in admin group?

@mathiashro You shouldn’t be trying to change the permissions of /Applications, but of your Caskroom.

The group is irrelevant, just your user needs to be correct.