Free, open-source macOS cleaner. CleanMyMac alternative with zero telemetry. Native SwiftUI, scheduled auto-cleaning, Xcode/Homebrew/system cache cleanup. MIT licensed.
Swift cache-cleanercleanmymaccleanupdisk-cleanerdisk-spacehomebrewmac-utilitymacosmacos-appmacos-cleanermacosxnativeossosxprivacyswiftswiftuisystem-cleanerxcode-cleaner
fix: permission flow refinements + bump to 2.5.2 (build 11)
moamenc0a63d953c43
diff --git a/PureMac.xcodeproj/project.pbxproj b/PureMac.xcodeproj/project.pbxprojindex 137626e..3c831bd 100644--- a/PureMac.xcodeproj/project.pbxproj+++ b/PureMac.xcodeproj/project.pbxproj@@ -521,7 +521,7 @@CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;COPY_PHASE_STRIP = NO;- CURRENT_PROJECT_VERSION = 10;+ CURRENT_PROJECT_VERSION = 11;DEBUG_INFORMATION_FORMAT = dwarf;DEVELOPMENT_TEAM = H3WXHVTP97;ENABLE_STRICT_OBJC_MSGSEND = YES;@@ -543,7 +543,7 @@GENERATE_INFOPLIST_FILE = NO;INFOPLIST_FILE = PureMac/Info.plist;MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 2.5.1;+ MARKETING_VERSION = 2.5.2;MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;MTL_FAST_MATH = YES;ONLY_ACTIVE_ARCH = NO;@@ -645,7 +645,7 @@CODE_SIGN_STYLE = Automatic;COMBINE_HIDPI_IMAGES = YES;COPY_PHASE_STRIP = NO;- CURRENT_PROJECT_VERSION = 10;+ CURRENT_PROJECT_VERSION = 11;DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";DEVELOPMENT_TEAM = H3WXHVTP97;ENABLE_NS_ASSERTIONS = NO;@@ -661,7 +661,7 @@GENERATE_INFOPLIST_FILE = NO;INFOPLIST_FILE = PureMac/Info.plist;MACOSX_DEPLOYMENT_TARGET = 13.0;- MARKETING_VERSION = 2.5.1;+ MARKETING_VERSION = 2.5.2;MTL_ENABLE_DEBUG_INFO = NO;MTL_FAST_MATH = YES;ONLY_ACTIVE_ARCH = NO;diff --git a/PureMac/Services/FullDiskAccessManager.swift b/PureMac/Services/FullDiskAccessManager.swiftindex 614b00f..d33ba36 100644--- a/PureMac/Services/FullDiskAccessManager.swift+++ b/PureMac/Services/FullDiskAccessManager.swift@@ -58,26 +58,28 @@ final class FullDiskAccessManager {/// The OS only registers an app in the FDA pane after that app itself/// makes a TCC-gated syscall. Metadata lookups (fileExists, isReadableFile)/// don't qualify, and delegating to Finder via AppleScript registers- /// *Finder* — not PureMac. So at launch we touch a broad set of protected- /// paths directly. The reads will fail until the user grants access;- /// that's fine — the failed attempts are what register us. Probing more- /// surfaces (Mail, Safari, Messages, HomeKit) widens the set of TCC- /// services the OS catalogues against PureMac so the bundle shows up- /// reliably the first time the user opens the Privacy pane.+ /// *Finder* — not PureMac. So at launch we touch a small set of paths+ /// gated specifically by the SystemPolicyAllFiles (FDA) service. The reads+ /// will fail until the user grants access — that's fine, the failed+ /// attempts are what register us.+ ///+ /// We intentionally do NOT probe Messages, Contacts, Calendars, or other+ /// paths gated by separate TCC services. Touching those would register+ /// PureMac in unrelated permission lists ("Messages", "Contacts", etc.)+ /// even though we never use them — confusing and a privacy regression.func triggerRegistration() {DispatchQueue.global(qos: .utility).async {let home = FileManager.default.homeDirectoryForCurrentUser.path+ // FDA-only probes. Each path here is read-gated by+ // SystemPolicyAllFiles, nothing else.let probePaths = ["/Library/Application Support/com.apple.TCC/TCC.db","\(home)/Library/Mail","\(home)/Library/Safari/CloudTabs.db","\(home)/Library/Safari/Bookmarks.plist",- "\(home)/Library/Messages/chat.db",- "\(home)/Library/Application Support/AddressBook",- "\(home)/Library/Calendars",+ "\(home)/Library/Cookies",+ "\(home)/Library/HTTPStorages","\(home)/Library/Application Support/com.apple.TCC",- "\(home)/Library/Application Support/MobileSync",- "\(home)/Library/Containers",]for path in probePaths {_ = self.canActuallyRead(path: path)diff --git a/PureMac/Services/PermissionCoordinator.swift b/PureMac/Services/PermissionCoordinator.swiftindex 041ca1d..9cd7bf0 100644--- a/PureMac/Services/PermissionCoordinator.swift+++ b/PureMac/Services/PermissionCoordinator.swift@@ -48,6 +48,7 @@ final class PermissionCoordinator: ObservableObject {private var pollTimer: Timer?private var onGrantCallback: (() -> Void)?+ private var pendingGrantWork: DispatchWorkItem?private init() {hasFullDiskAccess = FullDiskAccessManager.shared.hasFullDiskAccess@@ -113,6 +114,11 @@ final class PermissionCoordinator: ObservableObject {func dismiss(callRetry: Bool = false) {stopPolling()+ // Cancel any pending 1-second post-grant retry — without this, a user+ // who skips the sheet during the success-display delay would still+ // see the retry execute, which contradicts their explicit dismiss.+ pendingGrantWork?.cancel()+ pendingGrantWork = nillet callback = onGrantCallbackonGrantCallback = nilisRequesting = false@@ -168,13 +174,21 @@ final class PermissionCoordinator: ObservableObject {let callback = onGrantCallbackonGrantCallback = nilstopPolling()- // Give the success state ~1s on screen so the user sees the- // confirmation tick before the sheet snaps closed.- DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) { [weak self] in- self?.isRequesting = false- self?.failedItemPaths = []- self?.context = .general+ // Cancel any prior pending grant work — guarantees the callback fires+ // at most once even if grant is detected twice in rapid succession+ // (e.g. immediate-read + first poll tick both fire).+ pendingGrantWork?.cancel()+ let work = DispatchWorkItem { [weak self] in+ guard let self else { return }+ self.isRequesting = false+ self.failedItemPaths = []+ self.context = .general+ self.pendingGrantWork = nilcallback?()}+ pendingGrantWork = work+ // Give the success state ~1s on screen so the user sees the+ // confirmation tick before the sheet snaps closed.+ DispatchQueue.main.asyncAfter(deadline: .now() + 1.0, execute: work)}}diff --git a/PureMac/ViewModels/AppState.swift b/PureMac/ViewModels/AppState.swiftindex 33f8e0a..85a3a2a 100644--- a/PureMac/ViewModels/AppState.swift+++ b/PureMac/ViewModels/AppState.swift@@ -58,6 +58,11 @@ final class AppState: ObservableObject {@Published var isScanningAppFiles: Bool = false@Published var removalError: String?@Published var removalNeedsFullDiskAccess = false+ /// Snapshot of the URLs that failed the most recent uninstall due to a+ /// permission denial. Frozen at finishRemoval time so AppFilesView's+ /// retry path operates on the failed batch even if the user clicks a+ /// different app or mutates selection while the FDA sheet is open.+ @Published var lastFailedRemovalURLs: [URL] = []@Published var appFileScanLocationCount: Int = 0// MARK: - Services@@ -271,6 +276,9 @@ final class AppState: ObservableObject {failed: [URL],adminError: String?) {+ // Freeze the failed batch before the FDA sheet opens so the retry+ // path can't be poisoned by later selection edits or app switches.+ lastFailedRemovalURLs = needsFullDiskAccess ? failed : []removalNeedsFullDiskAccess = needsFullDiskAccessif let message = removalFailureMessage(needsFullDiskAccess: needsFullDiskAccess,diff --git a/PureMac/Views/Apps/AppFilesView.swift b/PureMac/Views/Apps/AppFilesView.swiftindex 11bd328..5900def 100644--- a/PureMac/Views/Apps/AppFilesView.swift+++ b/PureMac/Views/Apps/AppFilesView.swift@@ -96,12 +96,15 @@ struct AppFilesView: View {.onChange(of: appState.removalNeedsFullDiskAccess) { needs in// FDA-fixable removals jump straight into the rich sheet, the// same flow cleanup uses. The user grants permission once and we- // re-fire the original selection — no re-checking files.+ // re-fire the failed batch — using the frozen snapshot from+ // AppState so a mid-sheet selection change or app switch doesn't+ // re-trash the wrong files.guard needs else { return }- let toRetry = Array(appState.selectedFiles)+ let toRetry = appState.lastFailedRemovalURLslet items = toRetry.map { appState.makeUninstallCleanableItem(for: $0) }appState.removalError = nilappState.removalNeedsFullDiskAccess = false+ appState.lastFailedRemovalURLs = []appState.requestFullDiskAccessAndRetry(items: items,context: .uninstall(appName: app.appName, failedCount: items.count)diff --git a/project.yml b/project.ymlindex 41d1574..40dc24b 100644--- a/project.yml+++ b/project.yml@@ -23,8 +23,8 @@ settings:CODE_SIGN_ENTITLEMENTS: "PureMac/PureMac.entitlements"INFOPLIST_FILE: "PureMac/Info.plist"PRODUCT_BUNDLE_IDENTIFIER: "com.puremac.app"- MARKETING_VERSION: "2.5.1"- CURRENT_PROJECT_VERSION: "10"+ MARKETING_VERSION: "2.5.2"+ CURRENT_PROJECT_VERSION: "11"GENERATE_INFOPLIST_FILE: "NO"ASSETCATALOG_COMPILER_APPICON_NAME: "AppIcon"COMBINE_HIDPI_IMAGES: "YES"