Error: It seems there is already a Binary installing docker cask with homebrew

If you want to install Docker Desktop with Homebrew, you can use the cask. However, if you’ve already installed docker with Homebrew, you might bump in to an error:

brew install --cask docker
==> Downloading https://desktop.docker.com/mac/main/amd64/72729/Docker.dmg
######################################################################## 100.0%
==> Installing Cask docker
==> Moving App 'Docker.app' to '/Applications/Docker.app'
==> Linking Binary 'docker-compose.bash-completion' to '/usr/local/etc/bash_completion.d/docker-compose'
==> Unlinking Binary '/usr/local/etc/bash_completion.d/docker-compose'
==> Backing App 'Docker.app' up to '/usr/local/Caskroom/docker/4.3.2,72729/Docker.app'
==> Removing App '/Applications/Docker.app'
==> Purging files for version 4.3.2,72729 of Cask docker
Error: It seems there is already a Binary at '/usr/local/share/zsh/site-functions/_docker'

To correctly install Docker Desktop, first remove docker and then re-install the cask:

brew remove docker
brew install --cask docker

Finally, install docker again to get the command line tools back.

brew install docker
← Previous Next →