Closed Risinggoblin closed 1 week ago
Out of curiosity, does the brew cleanup function not work for you?
This was my bad, apologies. I had missed the "allow terminal acess" MacOS pop-up. Once I allow, this works well. Apologies again
No worries, glad it works now :)
There is not "allow terminal access" MacOS pop-up on my Mac, and I can not find any option to turn it on. I can only find "Finder" access for Pearcleaner, not the terminal access. macOS 15.1.1
There shouldn't be a terminal access permission under Automation settings page. It should only have Finder and System Events. The app uses apple script to tell terminal to launch indirectly.
Somehow it shows Terminal
access now, but it does not run terminal automatically to do the brew uninstall.
I don't have that Systems Events
access
Can you run this in a separate Terminal window:
log stream --level debug --style compact --predicate 'subsystem == "com.alienator88.Pearcleaner"'
Then attempt to uninstall an app that is also installed via homebrew. See if it spits out any errors in the terminal window.
Nothing special. That Matlab app is not what I was trying to uninstall
That's odd..what app are you trying to remove? Can you show me a screenshot of it and the files it finds for it?
That's odd..what app are you trying to remove? Can you show me a screenshot of it and the files it finds for it?
Hmm..I can't reproduce the issue. I installed Latest from homebrew, opened it and clicked around a bit to generate some cache files. Then I uninstalled from Pearcleaner and the Terminal popped up and ran through the cleanup process.. I ran it in debug mode in Xcode and got absolutely zero errors, so it might be something environmental to your OS regarding permissions. I'm also on 15.1.1 Sequoia so not exactly sure what's going on.
Hmm..I can't reproduce the issue. I installed Latest from homebrew, opened it and clicked around a bit to generate some cache files. Then I uninstalled from Pearcleaner and the Terminal popped up and ran through the cleanup process.. I ran it in debug mode in Xcode and got absolutely zero errors, so it might be something environmental to your OS regarding permissions. I'm also on 15.1.1 Sequoia so not exactly sure what's going on.
It is a newly bought MacBook a week ago, so I don't know what is wrong with my OS environment.
Can you trigger some command to let it access System Events
?
So Pearcleaner checks permissions on launch. It executes an apple script command to request system events.
This other user had a similar issue and theirs was resolved after reinstalling the OS. I think just strange Sequoia problems: https://github.com/alienator88/Pearcleaner/issues/115#issuecomment-2393120444
Below is the app that I developed, it also uses AppleScript, it can successfully trigger System Events
, I may have to take a look when I get some time.
https://github.com/Bigwig-Club/Account-Switcher
I looked more into this and I don't think the System Events permission is an issue here.
I use System Events for the Cmd+Z function when you delete files to undo the deletion via Finder. Maybe you haven't used it yet to have it ask for that permission: https://github.com/alienator88/Pearcleaner/blob/8ed2de96be381a76e68f1f7f60083b2b153521d7/Pearcleaner/Logic/Logic.swift#L275
This is where I use Terminal to run the cleanup task: https://github.com/alienator88/Pearcleaner/blob/8ed2de96be381a76e68f1f7f60083b2b153521d7/Pearcleaner/Logic/Logic.swift#L539
Yeah, it now has system events permissions after I pressed CMD + Z, but still no terminal pops up to do brew uninstall command
I'll make a custom build for you tomorrow with a button to trigger a simple Terminal command via AppleScript. I'll have it print logs with debugging to see if it's an issue with the command or something else.
I'll make a custom build for you tomorrow with a button to trigger a simple Terminal command via AppleScript. I'll have it print logs with debugging to see if it's an issue with the command or something else.
No hurry, take your time and big thanks!
Something I'm curious about to see if it's an issue with Pearcleaner or something else, let's try automating terminal outside of my app. Open Script Editor on your Mac and run this:
tell application "Terminal"
activate
do script "echo 'Test'"
end tell
Does the Terminal window open?
Terminal window open successfully
Cool, I'll follow up tomorrow
Try this build, there's a Terminal button in the middle of the app, can't miss it: Pearcleaner.zip
It should run the same command you tested in Script Editor. If it fails to open the window, run it with that debug command from before in terminal and see if it captures any logs.
OK, I now fully understand what is causing the issue, and it is nothing to do with your test build.
If the close after uninstall
option is on, the auto brew uninstall command won't execute.
Also I have found some other bugs:
CLI support
can't be enabled, and here is the error log
close after uninstall
says it will only affect when Pearcleaner is opened via Finder extension, but if I open the app normally , it will also close itself after uninstall.
Nice find! Would you be able to add these as a new issue so I can track them better? I think I know why at least 2 of those happen.
Is your feature request related to a problem? Please describe.
When removing an application installed via Homebrew using Pearcleaner, Homebrew is not updated to reflect this action. This can cause discrepancies where Homebrew continues to list the app as installed, potentially leading to issues during updates or re-installations.
Describe the solution you’d like
It would be great if Pearcleaner could detect whether an application was installed via Homebrew and execute the
brew uninstall <app>
command in the background when the app is removed. This would ensure Homebrew’s local package database remains accurate and up-to-date, eliminating the need for manually runningbrew uninstall <app>
Describe alternatives you’ve considered • Manually running
brew uninstall <app>
after using Pearcleaner to remove an application.Additional context
Pearcleaner could include a pre-check to confirm whether the app is listed in Homebrew before executing the command. Additionally, this can be an optional setting which can be toggled on or off based on user preference