mas
mas copied to clipboard
`uninstall` does not work on macOS 11.1+
Your Environment
- mas version: 1.7.1
- macOS version: 11.1
mas Install Method
-
brew install mas
(homebrew-core)
Describe the Bug
mas uninstall [id]
complains it needs root permissions to uninstall but sudo mas uninstall [id]
says the app is not installed.
To Reproduce
Steps to reproduce the behavior:
- Install an app;
mas install [id]
- Uninstall the app with
sudo mas uninstall [id]
Expected Behavior
Moves the app to the Trash Bin
Actual Behavior
It will say: Error: not installed
Screenshots, Terminal Output
Additional Context
None
I'm seeing the same issue on MAS 1.7.1 on macOS 11.2
Same as @endlesslycurious; at least for the second part it seems like MAS is engineered so that when run as root with sudo (or su) it would look for app store installations by the root user, which would (normally) be none, as opposed to when run with normal user privileges. And macOS probably doesn't allow uninstallation of an app without root password at all... interesting quandary, not sure how you might fix it.
Works with sudo -s
if that helps anyone, but things end up in root's trash:
==> App moved to trash: /private/var/root/.Trash/Telegram.app
Same issue here, my mas
' version is 1.8.2
and macOS
is 11.4
.
Same in BS 11.6 and mas 1.8.3. Uninstall not working, says "not installed".
same issue on:
- macOS 12.0.1 (21A559)
- mas 1.8.5
mas uninstall 408981434
Warning: Apps installed from the Mac App Store require root permission to remove.
Error: Unable to move app to trash.
Error: Uninstall failed
sudo mas uninstall 408981434
Error: Not installed
sudo -s mas uninstall 408981434
Error: Not installed
mas list
408981434 iMovie (10.2.5)
Same issue
- MacOS 11.5.2 (M1 Mac)
- MAS 1.8.6
Same issue for me:
mas uninstall 897118787
Error: Not installed
Any new on what's causing this?
sudo -s doesn't sove it!
MacOS 12.2.1 and still not working

Also an issue for me on MAS 1.8.6
for Mac 12.4
Same issue for me:
mas uninstall 897118787 Error: Not installed
Any new on what's causing this?
sudo -s doesn't sove it!
Same here!
Macos 12.6.4 (21G511) Same here
I'm not a Swift programmer but I'm guessing something in this function has changed? https://github.com/mas-cli/mas/blob/main/Sources/MasKit/Commands/Uninstall.swift
public func run(_ options: Options) -> Result<Void, MASError> { let appId = UInt64(options.appId)
guard let product = appLibrary.installedApp(forId: appId) else {
return .failure(.notInstalled)
}
It's a permission issue related to macOS's security sandbox : When you use sudo, the command is ran with root privileges and in the root environment, but doesn't have access to your user-specific App Store data. This is why the mas
command is unable to see the installed apps and uninstall them. You can verify this by running mas list
(will show your apps) and sudo mas list
(will be empty).
To fix this, I'm afraid we'll need something like a Privileged Helper Tool (https://developer.apple.com/library/archive/documentation/Security/Conceptual/SecureCodingGuide/Articles/AccessControl.html#//apple_ref/doc/uid/TP40007244-SW5). A working example of this can be found under "EvenBetterAuthorizationSample".
Unfortunately I'm not experienced with Swift, otherwise I'd look into this, but that's basically what's going on.
(related?: https://github.com/mas-cli/mas/issues/417)
So mas hasn't had an uninstall function in 3 years?
Still having the same issue
- MAS Version: 1.8.6
- Mac OS: 13.6.6