21

I am using this command to install app in macOS Monterey(the apple M1 pro chip), but facing a problem like this:

➜  ~ brew install --cask dbeaver-community
==> Downloading https://dbeaver.io/files/21.3.2/dbeaver-ce-21.3.2-macos-aarch64.dmg
Already downloaded: /Users/xiaoqiangjiang/Library/Caches/Homebrew/downloads/c4fed662e860fd6ca0099f59da082b651e219af2b3369c1f85363dbc7469d1f2--dbeaver-ce-21.3.2-macos-aarch64.dmg
==> Installing Cask dbeaver-community
==> Purging files for version 21.3.2 of Cask dbeaver-community
Error: It seems there is already an App at '/Applications/DBeaver.app'.

is it possible to override the old app using homebrew but keep the old app config?

Dolphin
  • 1,101
  • 8
  • 25

3 Answers3

24

using this command fix it:

➜  ~ brew install --cask dbeaver-community --force
==> Downloading https://dbeaver.io/files/21.3.2/dbeaver-ce-21.3.2-macos-aarch64.dmg
Already downloaded: /Users/xiaoqiangjiang/Library/Caches/Homebrew/downloads/c4fed662e860fd6ca0099f59da082b651e219af2b3369c1f85363dbc7469d1f2--dbeaver-ce-21.3.2-macos-aarch64.dmg
==> Installing Cask dbeaver-community
Warning: It seems there is already an App at '/Applications/DBeaver.app'; overwriting.
==> Removing App '/Applications/DBeaver.app'
==> Moving App 'DBeaver.app' to '/Applications/DBeaver.app'
  dbeaver-community was successfully installed!
Dolphin
  • 1,101
  • 8
  • 25
  • 1
    --force doesn't work for me and it is still failing with error that this or that binary file already exists. I kept deleting them but there are many of them. --overwrite doesn't work with --cask – xbmono Mar 31 '22 at 02:14
  • Works, but less than ideal. It forcibly downloads and installs the package every time even of the latest version from the cask is already installed. Ideally --overwrite would work with --cask but these options are not compatible with each other. – user24601 Apr 16 '22 at 14:19
2

Repeating the following commands resolved the issue for me:

brew outdated
brew reinstall foo

2 wild output appeared:

Warning: It seems there is already an App at '/opt/homebrew/Caskroom/foo/21.3.2/foo.app'; overwriting.

and

Error: bar: Directory not empty @ dir_s_rmdir - /Applications/Bar.app

The wild Warning ran, so I could ignore it. But against the Error I had to fight. I figured, that the brew user did not have write permissions in a multi-user brew setup on that file. Deleting the file (with sudo or as a user or group member with write permissions) and then using brew reinstall led to get away safely from that Error.

Alternatively, one could probably change the owner of that file with the sudo and chown command and execute brew reinstall or brew install --force.

zs11
  • 134
-1

You can try using the flag --force. This suggestion comes from an answer to the problem on the official Homebrew GitHub page.

brew remove --force --cask <CASK_NAME>

Here's the actual result of my Google Chrome upgrade.

$ brew install --cask google-chrome --force

==> Upgrading 1 outdated package: google-chrome 112.0.5615.49 -> 121.0.6167.160 ==> Upgrading google-chrome ==> Downloading https://dl.google.com/chrome/mac/universal/stable/GGRO/googlechrome.dmg Already downloaded: /Users/hassaan/Library/Caches/Homebrew/downloads/88881e66883c4776fff9b3019b48a26795020439a33ddbedd3bd4620283aecd2--googlechrome.dmg Warning: No checksum defined for cask 'google-chrome', skipping verification. Warning: It seems there is already an App at '/opt/homebrew/Caskroom/google-chrome/112.0.5615.49/Google Chrome.app'; overwriting. ==> Removing App '/opt/homebrew/Caskroom/google-chrome/112.0.5615.49/Google Chrome.app' ==> Backing App 'Google Chrome.app' up to '/opt/homebrew/Caskroom/google-chrome/112.0.5615.49/Google Chrome.app' ==> Removing App '/Applications/Google Chrome.app' ==> Moving App 'Google Chrome.app' to '/Applications/Google Chrome.app' ==> Purging files for version 112.0.5615.49 of Cask google-chrome google-chrome was successfully upgraded!

Hassaan
  • 99