brew: `brew cleanup` fails when cask is defined in multiple taps

$ brew config 
HOMEBREW_VERSION: 2.1.2-12-g37f4b92
ORIGIN: https://github.com/Homebrew/brew
HEAD: 37f4b92644a255ef76e2e1c9df686211f610e82e
Last commit: 31 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: cedba1f1b4daf1605ff985fcaa7995fe2eb0f527
Core tap last commit: 4 hours ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_DEV_CMD_RUN: 1
HOMEBREW_VISUAL: subl -w
CPU: quad-core 64-bit kabylake
Homebrew Ruby: 2.3.7 => /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
Clang: 10.0 build 1001
Git: 2.21.0 => /usr/local/bin/git
Curl: 7.54.0 => /usr/bin/curl
Java: 11.0.3, 1.8.0_212, 1.8.0_202
macOS: 10.14.4-x86_64
CLT: 10.2.1.0.1.1554506761
Xcode: N/A
CLT headers: 10.2.1.0.1.1554506761
$ brew doctor 
Your system is ready to brew.

What you were trying to do (and why)

  • I added both homebrew/cask-versions and adoptopenjdk/openjdk as taps
  • In the past I installed adoptopenjdk8 via the adoptopenjdk tap. Now it is available in cask-versions as well.
  • I run the following once in a while:
brew cask upgrade
brew upgrade
brew cleanup
  • Because the cask adoptopenjdk8 is available in both taps, I get:
$ brew cleanup
Error: Cask adoptopenjdk8 exists in multiple taps:
  homebrew/cask-versions/adoptopenjdk8
  adoptopenjdk/openjdk/adoptopenjdk8
  • As I installed adoptopenjdk8 initially without a tap prefix, I already ran brew cask uninstall adoptopenjdk/openjdk/adoptopenjdk8 and brew cask install adoptopenjdk/openjdk/adoptopenjdk8 afterwards. But the error persists.

Another thing I do not understand:

$ brew cask list --full-name
adoptopenjdk8
apache-directory-studio
fliqlo
knockknock
vagrant
virtualbox
virtualbox-extension-pack
adoptopenjdk/openjdk/adoptopenjdk11

As can be seen adoptopenjdk11 is (correctly?!?) prefixed with the tap, but adoptopenjdk8 is not.

What happened (include command output)

  • brew cleanup fails.
  • Even worse it seems that even brew upgrade fails sometime, there seems to be a sort of automatic cleanup which happens after a specific amount of days:
$ brew upgrade
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
No changes to formulae.

==> Upgrading 1 outdated package:
derailed/k9s/k9s 0.6.5 -> 0.6.6
==> Upgrading derailed/k9s/k9s 
==> Downloading https://github.com/derailed/k9s/releases/download/0.6.6/k9s_0.6.6_Darwin_x86_64.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/167596393/718b3c80-723e-11e9-82df-3ff559a7fde5?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20190509%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20190509T
######################################################################## 100.0%
🍺  /usr/local/Cellar/k9s/0.6.6: 5 files, 39.8MB, built in 6 seconds
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /usr/local/Cellar/k9s/0.6.5... (5 files, 39.8MB)
Error: Cask adoptopenjdk8 exists in multiple taps:
  homebrew/cask-versions/adoptopenjdk8
  adoptopenjdk/openjdk/adoptopenjdk8

What you expected to happen

I can run brew cask upgrade && brew upgrade && brew cleanup successfully.

Step-by-step reproduction instructions (by running brew commands)

  • I actually did not remove brew completely, but as far as I understand this should reproduce this.
brew tap homebrew/cask-versions 
brew tap adoptopenjdk/openjdk
brew cask install adoptopenjdk/openjdk/adoptopenjdk8
brew cleanup # <-- chokes

See AdoptOpenJDK/homebrew-openjdk#106 as well.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 9
  • Comments: 17 (13 by maintainers)

Most upvoted comments

@MikeMcQuaid Yes, we absolutely need to fix this.

In the meantime, the issue can be worked around by removing the cached download:

rm -f ~/Library/Caches/Homebrew/Cask/adoptopenjdk8* \
  ~/Library/Caches/Homebrew/downloads/*-OpenJDK8*

@Archez, you seem to have an old tap, run brew untap caskroom/versions.

The same thing is happening for the chromedriver-beta cask as well. chromedriver exists on homebrew/cask chromedriver-beta exists on homebrew/cask-versions and caskroom/versions

What happens in my case is I just want to install chromedriver; however, the install fails when it performs the update check as I believe both packages have the same starting string, so the conflict clash happens.

$ brew cask install chromedriver
Updating Homebrew...
Error: Cask chromedriver-beta exists in multiple taps:
  homebrew/cask-versions/chromedriver-beta
  caskroom/versions/chromedriver-beta

This clash happens regardless if I run brew cask install chromedriver or brew cask install homebrew/cask/chromedriver so I essentially am unable to install this cask without removing one of the taps that contains chromedriver-beta.