Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Developer lists the simulators' logs with Xcode

Țugui Dragoș764c2ee1d76a
diff --git a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
index 70bccc92..2b484af3 100644
--- a/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
+++ b/Packages/PeelCore/Sources/PeelCore/Developer/DeveloperCaches.swift
@@ -199,6 +199,7 @@ public enum DeveloperCaches {
Folder("Library/Developer/Xcode/macOS DeviceSupport", .deviceSupport, source: "Xcode 27: CoreSymbolicationDT.framework/Resources/JSONCrashLog/DeviceSupportDirectories.py", rowsDepth: 1),
Folder("Library/Developer/Xcode/DocumentationCache", .cache, source: "Xcode 27: DVTFoundation.framework, -[DVTDeveloperPaths documentationCacheDirectoryForCurrentApplication]"),
Folder("Library/Developer/CoreSimulator/Caches", .cache, source: "https://developer.apple.com/documentation/xcode-release-notes/xcode-12_3-release-notes"),
+ Folder("Library/Logs/CoreSimulator", .logs, source: "Xcode 27: /Library/Developer/PrivateFrameworks/CoreSimulator.framework (\"%s/Library/Logs/CoreSimulator\")"),
Folder("Library/Caches/com.apple.dt.Xcode", .cache, source: "https://developer.apple.com/documentation/foundation/filemanager/searchpathdirectory/cachesdirectory"),
Folder("Library/Developer/Packages", .keptDownloads, source: "https://developer.apple.com/documentation/xcode-release-notes/xcode-16_2-release-notes"),
Folder("Library/Developer/Xcode/Archives", .archives, source: "Xcode 27: IDEFoundation.framework, -[IDEDeveloperPaths defaultDistributionArchivesLocation]", rowsDepth: 2, rowEnding: ".xcarchive"),
diff --git a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
index 1a12b386..7625f28f 100644
--- a/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
+++ b/Packages/PeelCore/Tests/PeelCoreTests/DeveloperCachesTests.swift
@@ -568,6 +568,19 @@ struct DeveloperCachesTests {
#expect(locations.first?.kind == .cache)
}
+ @Test func offersTheLogsOfTheSimulatorsAndSpaceLeavesThemToDeveloper() async throws {
+ let directory = try TemporaryDirectory()
+ try directory.file("Library/Logs/CoreSimulator/CoreSimulator.log", bytes: 400_000)
+ let xcode = DeveloperCaches.definitions.filter { $0.id == "xcode" }
+
+ let locations = await DeveloperCaches.scan(xcode, homeDirectory: directory.url).flatMap(\.locations)
+ let logs = directory.url.appending(path: "Library/Logs", directoryHint: .isDirectory)
+
+ #expect(locations.map(\.url.lastPathComponent) == ["CoreSimulator"])
+ #expect(locations.first?.kind == .logs)
+ #expect(DeveloperCaches.foldersLeftToDeveloper(inside: logs, home: directory.url).contains(["CoreSimulator"]))
+ }
+
/// virtualenvwrapper keeps the user's hook scripts beside the environments in `~/.virtualenvs`, so only the
/// environments are offered, and a link among them is left where it is, never followed.
@Test func offersVirtualenvwrappersEnvironmentsAndNotItsHooks() async throws {