When brew cleanup
shows the following error message:
Error: Cask adoptopenjdk8 exists in multiple taps:
homebrew/cask-versions/adoptopenjdk8
adoptopenjdk/openjdk/adoptopenjdk8
How can I resolve this error without reinstalling Homebrew?
FYI some relevant references:
- https://github.com/Homebrew/brew/issues/6112 – looks like an issue to be resolved on Homebrew itself
- https://github.com/AdoptOpenJDK/homebrew-openjdk/issues/106 – original bug report
- https://improve-future.com/en/how-to-solve-the-homebrew-error-cask-adoptopenjdk8-exists-in-multiple-taps.html – solved by reinstalling Homebrew
Best Answer
Here is a quick solution which assumes that Homebrew is up-to-date and there is no need to use any other packages from the
adoptopenjdk/openjdk
tap:Check the state of
adoptopenjdk/openjdk
tap andadoptopenjdk8
package:brew tap
- lists which taps are currently enabledbrew search adoptopenjdk8
- shows whichadoptopenjdk8
casks are available from the enabled taps and whichadoptopenjdk8
casks are currently installedNow assuming that the
adoptopenjdk/openjdk
tap is listed as enabled, remove theadoptopenjdk/openjdk
tap as follows:Then check what
adoptopenjdk8
casks are currently installed. This should show exactly oneadoptopenjdk8
cask installed.At this point,
brew cleanup
should work correctly.My explanation: it appears to me that they added
adoptopenjdk8
to the built-in Homebrew caskroom.Note that it should be OK to do
brew tap adoptopenjdk/openjdk
afterwards, if needed. (This has not caused any issues for me so far.)