Life is easier with simple scripting. Grateful for everyone's encouragement and support!
View this project on GitHub
Updated script that can do it all.
I decided the multi-step approach in the last post (Clean out the old apps completely) was cool in a sense that I see and control everything that gets found and processed. But sometimes, one tool is preferable.
So I wrote a Python script that does everything. A native Mac app? Of course. A wrapped container of an iPhone/iPad app? No sweat.
This script will display all the application specific files and folders and ask if you want to delete them. On Mac OS, it will send them to the user trash location. To completely release the disk space, empty your trash.
The script will only delete anything if you explicitly allow it it. Hitting anything else but a y
when prompted will continue with no changes made.
Download the Python script file. Place it anywhere in the system you like. Run it from anywhere in the system you like.
Command to use the script is included in the script file header. Or you can just run the script with no arguments and it will remind you how to use it.
$ python3 app-cleaner.py /Applications/<app-name>.app
Here is an example of an iOS app being deleted completely:
$ python3 app-cleaner.py /Applications/Damus.app
- 'Damus' is not running. Proceeding
- (This is not a regular Mac app, will search Containers.)
- Found Damus locations:
/Applications/Damus.app
/var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2
/var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2
/private/var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2
- Delete the above [y/n]? y
Moving to trash: /Applications/Damus.app
Moving to trash: /var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2
Moving to trash: /var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2
Moving to trash: /private/var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2
- There may be Damus containers. Looking
/Users/<your-user>/Library/Containers/911AC124-2940-47B3-830B-A6C70DBE16A8/Data/Library/Saved Application State/com.jb55.damus2~iosmac.savedState
/Users/<your-user>/Library/Containers/911AC124-2940-47B3-830B-A6C70DBE16A8/Data/Library/Preferences/com.jb55.damus2.plist
/Users/<your-user>/Library/Containers/911AC124-2940-47B3-830B-A6C70DBE16A8/Data/Library/Application Scripts/com.jb55.damus2
- Found container(s):
/Users/<your-user>/Library/Containers/911AC124-2940-47B3-830B-A6C70DBE16A8
- Delete the above [y/n]? y
Moving to trash: /Users/<your-user>/Library/Containers/911AC124-2940-47B3-830B-A6C70DBE16A8
And that is it. Then I emptied the trash.
To check if anything at all remains, I did the following:
$ python3 app-cleaner.py /Applications/Damus.app
- 'Damus' is not running. Proceeding
- /Applications/Damus.app not found. Exiting
$ find-all.sh damus
Searching everywhere for "*damus*" (case-insensitive) ...
$
The find-all.sh
comes from a script I shared previously when I was interested in simplifying finding files and text within files (Search blog post). The find scripts in all their versions is what I use almost daily and don’t have to remember to type out entire commands and their arguments. Super helpful.
In the future, I would love to dig into and understand why there are two identical results for the content in the user cache folder. If you notice the two lines of the same, above in the example? That seems to be a duplicate, but why?
/var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2
/var/folders/qp/fvwj41093d7c1ht9k_kmml100000gn/C/com.jb55.damus2