Also. Why not use both scripts? Both of them will miss stuff. Like when apps create weird random files to track licenses or trials.
Oh good, you pointed out another problem with homebrew, that it immediately abandons legacy systems, and apparently is inconsistent with those legacy systems.
MacPorts has been using /opt since 2002, works on Tiger and anything newer up to current. Homebrew came into existence superfluously in 2008 and only through fanaticism grew, and for no good reason, as it merely duplicated some of MacPorts functionality, focusing on binary installations. Eventually, Homebrew could also build from source, duplicating more of MacPorts functionality. Then I suppose in 2020, homebrew tried to wallpaper across MacPorts and use /opt, 18 years after /opt/local priority was established by MacPorts.
FWIW /opt/homebrew does not actually conflict with /opt/local/
and if homebrew never honored system permissions, what makes you think it's going to start?
> Also. Why not use both scripts? Both of them will miss stuff. Like when apps create weird random files to track licenses or trials.
No, my script will uninstall everything the installer installed, because everything the installer installed is listed in the Bill of Materials. Any other files which were not installed by the installer can be considered documents. Uninstalling an application should not delete the documents, you can do that manually, including anything left in /Library or ~/Library(/Application Support etc.) that the application may have created but the installer did not install, because these, again, are documents, and should not be uninstalled, but instead manually deleted if desired.
[1] https://github.com/morgant/tools-osx/blob/master/src/trash
port install trash
I had not heard of trash! It seemed so strange to me that rmtrash was not named trash that I had aliased it. I'm not sure which came first, but if it was rmtrash.... how did the dev miss that? Probably a story there, unless rmtrash is newer.
Homebrew does not honor the default privileges of /usr/local; directory ownership is changed from root with group permissions for the wheel group to the installing user and the "admin" group. Specifically, the mode changes from drwxr-xr-x root wheel to drwxrwxr-x myuser admin. All files, not just the directories, have their ownership changed by the installer. This is considered by some as a major security flaw.[1]
MacPorts is superior and it is what the pros use. Now enough of that.
OP's method pays absolutely no attention to the BoM Receipts that every application installed with an installer will honor. This method doesn't consult the BoM, and obviously leaves stuff lying around.
BoMs are found in /var/db/receipts for all App Store installations and updates, and all other installations performed by the Installer app. macOS system, security, and security data updates have their BoMs stored in /System/Library/Receipts
Below somewhere is a superior uninstaller script I picked up at some point. First install the appropriate version of Xcode for your macOS version. Then install MacPorts package manager thusly:
Add this line to your ~/.bash_profile Then drop below in a file in your ~/bin (or /usr/local/bin if you want all users to have access), maybe call it "uninstaller," and -------------------------- --------------------------make sure to install rmtrash before using
To make this clearer, user must find the BoM receipt and the path to the BoM for whatever application for the input for this script. Again find BoMs in /var/db/receipts or /System/Library/ReceiptsSo, for e.g., say you've installed an application called Test.app. First find the $PATH to the correct BoM then call its path with the script.
after entering password, this execution will uninstall everything that installer installed for Test.app because all those files are listed in the BoM, and it will move all files the Test.app installer installed into your Trash.I think it is just nuts to use /bin/rm in a script like this, so rmtrash is a little cli utility that moves things into your Trash, rather than deleting immediately. Much safer. Also, my script does not rely on Spotlight (mdfind). No telling what mdfind will return. Use the Bill of Materials receipts to uninstall, not Spotlight. That's crazy talk.
[1] https://en.wikipedia.org/wiki/Homebrew_(package_manager)#Imp...