MacOS – Installed App with Brew Cask Over Existing Install, Did it Remove the Old App Files

homebrewinstallmacossymlink

I upgraded to the latest OpenOffice (from 3.4.1 to 4.1.1) with brew-cask without realizing OpenOffice 4 was already installed:

$ brew cask install openoffice
==> Downloading http://downloads.sourceforge.net/sourceforge/openofficeorg.mirror/Apache_OpenOffice_4.1.1_MacOS_x86-64_install_en-US.dmg
######################################################################## 100.0%
==> Symlinking App 'OpenOffice.app' to '/Users/shwaydogg/Applications/OpenOffice.app'
?  openoffice staged at '/opt/homebrew-cask/Caskroom/openoffice/4.1.1' (3180 files, 385M)

I'm worried that the old install with ~400MB is still there just not linked. Or does brew-cask writing the the symlink over the old app effectively delete the files? / Perhaps BrewCask was smart enough to take this into account?

How could I check?


update: did as @njbook suggested in comments:

$ brew-cask cleanup
==> Removing dead symlinks
Nothing to do
==> Removing cached downloads
/Library/Caches/Homebrew/openoffice-4.1.1.dmg
/Library/Caches/Homebrew/Casks/openoffice-4.1.1.dmg

There's no mention of the an old install being removed.

Another way to phrase my question perhaps more directly is in a unix system if a directory is replaced with a symlink pointing elsewhere are the files within the directory still taking up space on disk and if so how can they be found?

Best Answer

Cask does not clean up old versions by default. It stages the installs in /opt/homebrew-cask/Caskroom/$APPNAME and then symlinks them in to ~/Applications or /Applications depending on the brew recipe. And then it leaves the old versions around until you run brew cleanup.

You can see old installs of OpenOffice under /opt/homebrew-cask/Caskroom/openoffice. You can safely delete the old installs from there, though brew cleanup is supposed to do this for you.

If you had previously installed OpenOffice using their DMG installer and not Homebrew Cask, it was most likely installed in /Applications and not ~/Applications. Cask won't install over top of an existing installation that wasn't previously Cask-installed itself. So check /Applications and make sure you remove the old version from there if hadn't installed it via Cask. If you had installed it via Cask all you need to do is delete it from /opt/homebrew-cask/Caskroom/openoffice as mentioned above.