Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] When deleting apps, auto detect .pkg apps and use native tools to assist with uninstalling #134

Open
SlCKB0Y opened this issue Oct 24, 2024 · 4 comments

Comments

@SlCKB0Y
Copy link

SlCKB0Y commented Oct 24, 2024

Is your feature request related to a problem? Please describe.

Forgive me if this is already implemented but this might be a good idea. As you're aware, there are a bunch of ways an app can be installed, by dragging the app bundle to /Applications, via Hombrew and other third-party package managers, but also in the form of .pkg files (Eg. MS Teams), which is the "native" MacOS package format.

Describe the solution you'd like

When an App is deleted with this software, it would be a good idea if it checked if the file was installed as a .pkg file. This can be demonstrated on the command line with the "pkgutil --pkgs" command. The pkgutil command line app has a host of other features, including tracking all files installed by the .pkg file but also all files created by the .pkg. Implementing this could increase the accuracy and might also prevent the pkg file database becoming out of sync if a .pkg app is just uninstalled (similar to just deleting an RPM or DEB based app on Linux by just removing the files).

There is a dedicated app which basically acts as a frontend to pkg and allows removal. It's cheap but it would be nice if this could all be done your app: https://www.corecode.at/uninstallpkg/

I assume you are already taking this approach with apps installed via Homebrew etc.

@alienator88
Copy link
Owner

That's a good idea!
It shouldn't be too difficult to implement.
I'll need to play around with the pkgutil to see what all I can do with it.
Maybe I can add it as a separate view in the top right page drop down and have it load all pkg type apps and allow uninstall via that for each.

@alienator88
Copy link
Owner

alienator88 commented Nov 4, 2024

Are you aware if pkgutil command has some type of uninstall command? I didn't see anything.
I'm able to pull the list of installed packages, but not seeing a built-in way to uninstall all the related files. That might need to be manual work.
Seems like you can only forget a package to unregister it.

@Omoeba
Copy link

Omoeba commented Dec 15, 2024

I think a good way to implement this is to just add all the files from pkgutil --files into the files list and run pkgutil --forget when the user clicks the trash button. This is similar to how Homebrew implements it.

@alienator88
Copy link
Owner

One thing I was stuck on is that --forget for pkgutil seems to require sudo.
So if the trash command requires sudo to delete some of the files in the list, it will prompt for sudo first.
Then if I run forget after, it will ask for sudo again for the forget command. Not very great user experience with my current setup.

I might need to wait to add this in later down the line as I was looking to possibly setup a helper tool for sudo commands to get away from AppleScript and all the other little restrictions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants