Uninstalling App Store apps from the command line
Over the weekend, Rasmus Sten posted to Twitter about an interesting uninstall command line utility that he had found while testing 10.10.
On investigation, it became apparent that this uninstall utility was not new and was available starting in 10.7.x and later. It also appears to be undocumented and has neither a man page or help pages available.
To use the uninstall tool:
1. Log into the Mac in question
2. Verify that your application was installed by the App Store
3. Open Terminal
4. Run the following command with root privileges:
5. You will be prompted to authenticate with an administrator’s username and password
6. The application should then be uninstalled.
After working with this tool, it does have some limitations. For more details, see below the jump.
It appears that the uninstall tool can only be used to uninstall applications that were installed by the App Store and only when logged in. When I tried to uninstall an App Store-installed application while the Mac was logged out, I received this message.
My working assumption is that the authentication dialog window is a necessary part of the process. Even when run with root privileges, the separate authentication is needed or the uninstall daemon cannot be contacted.
I also tried to uninstall an application that had not been installed via the App Store. In that case, the application was not uninstalled. Instead, I received the following message:
I was able to uninstall an App Store-installed application while logged in as a different user account than the account who installed the applications from the App Store. In my testing of this, I had also not signed into the App Store while logged into the different user account.
Even though I was logged in as a different user and hadn’t signed into the App Store, I was still able to uninstall App Store-install applications.
Based on this testing, it appears that the uninstall tool has the following requirements:
- The uninstall tool must be run from a account that is logged in at the console.
- The uninstall tool must be able to display the authentication dialog window.
- The application being uninstalled must have originally been installed by the App Store.
- The account running the uninstall tool must have both administrative rights and sudo privileges, in order to run the command with root privileges and properly authenticate at the authentication dialog window.
Since the uninstall tool itself appears to be undocumented, that’s all the information I currently know about it.
Have any more information? Please let me know in the comments.