mas: [BUG] Uninstall using sudo always fails the first time
Describe the bug
It’s a known limitation that the uninstall must be run using sudo. However, it always fails with the message “Error: Not installed” the first time the command is run using sudo. 2nd time seems to work fine.
$ mas info 883878097
macOS Server 5.7.1 [19.99]
By: Apple Inc.
Released: Sep 28, 2018
Minimum OS: 10.14
Size: 106.5 MB
From: https://itunes.apple.com/us/app/macos-server/id883878097?mt=12&uo=4
$ mas uninstall 883878097 --dry-run
==> Server /Applications/Server.app
==> (not removed, dry run)
$ mas uninstall 883878097
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 883878097
Password:
Error: Not installed
$ sudo mas uninstall 883878097
==> App moved to trash: /private/var/root/.Trash/Server.app
To Reproduce Steps to reproduce the behavior:
- Run
mas uninstall 883878097 --dry-runto verify app (macOS Server) is installed - Run
sudo mas uninstall 883878097 - See error
- Run
sudo mas uninstall 883878097again - Observe success
Expected behavior
The first time the sudo mas uninstall 883878097 command is ran it should succeed.
Actual behavior
sudo mas uninstall 883878097 fails. It must be run a 2nd time.
Desktop (please complete the following information):
- mas version 1.6.2
- macOS version: 10.14.3
- How did you install mas? brew
Additional context
The uninstall command was added in 1.5.0 (#191)
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 10
- Comments: 17 (5 by maintainers)
Commits related to this issue
- Remove cleanup role The cleanup role has been removed again due to an issue with the MAS command-line utility. Uninstalling apps requires sudo priviledges, but even running the CLI as sudo does not h... — committed to jdno/workstation by jdno 2 years ago
- Remove cleanup role (#35) The cleanup role has been removed again due to an issue with the MAS command-line utility. Uninstalling apps requires sudo priviledges, but even running the CLI as sudo do... — committed to jdno/workstation by jdno 2 years ago
I do have the very same issue and can’t uninstall anything even on the nth attempt:
I also have this same issue no matter how many times I use
sudo… Seriously I can’tmas uninstall <id>and there’s no way to remove it frommas listSame with
macOS 13.1 22C65 arm64Using AppCleaner to uninstall did work though.
Using “AppCleaner” worked for me.