Vibe-coded with DeepSeek V4.1 Flash / OpenCode.
A native macOS app — built with Swift / SwiftUI / SPM — for inspecting .app bundles. Drop any .app onto the window and SwiftLens unpacks its identity, signature, quarantine state, architectures, entitlements, embedded sub-bundles, and dozens of other Info.plist fields in a single, scrollable report.
SwiftLens runs inside the App Sandbox — it reads app bundles selected by the user, never launches codesign / spctl, and never modifies inspected bundles. Signing information and quarantine flags are read through Apple's Security framework and getxattr. A quarantine-removal command can be copied to the clipboard; saved baselines are stored in SwiftLens’s own Application Support directory.
中文版说明请见 README.zh-CN.md.
- Report layout and navigation — switch between one and two columns with
More ▸ Two-column view. The setting is remembered and applies to the main inspector. UseJump to Sectionabove the report andMore ▸ Rescan(⌘R) to refresh the current bundle. - Version review — the comparison window highlights changes to signing, entitlements, system requirements, privacy, components and launch items. Copy the differences as Markdown or JSON, or see which directories and files account for the most growth or reduction. Drop two
.appbundles into the main window to compare directly, or fill a comparison slot from Recent Apps. - Release baselines — use
More ▸ Save Release Baseline…to capture comparison metadata and file hashes. In a comparison slot, chooseOpen Baseline…or drop the.swiftlenssnapshotfile to compare after the original bundle is gone. - Inspection details — open a bundled component’s details to see entitlements, per-slice deployment metadata and direct dependencies. The main report can check a chosen architecture and macOS version, list the largest files and show paths reported by Security framework when strict validation fails.
- Drag-and-drop or pick any
.appbundle — instant, single-window, no project list. Race-condition safe: a token tag prevents the older scan from overwriting the newer one when you drag in a second app before the first finishes. - Bilingual UI — switches live between English and 简体中文 without an app relaunch (Follow system / 中文 / English); every GUI string and CLI line is localized.
- Top header badges — click any badge to jump straight to the related section: architectures / Agent-or-Background / iOS port / signature state / validity / notarization / sandbox / quarantine, plus a version badge next to the app name.
- Basic identity —
CFBundleIdentifier,CFBundleShortVersionString/CFBundleVersion,CFBundleExecutable, package type, development region,NSPrincipalClass, copyright, version variants, supported platforms. - Runtime & deployment —
LSMinimumSystemVersionandMinimumOSVersion(iOS / Catalyst ports are not silently dropped; when both are missing, falls back to the main executable'sLC_BUILD_VERSION/LC_VERSION_MIN_*minimum OS),LSApplicationCategoryType, high-resolution / graphics-switching / safe-area / sudden-termination switches, and the full build toolchain (DTSDKName,DTPlatformVersion,DTXcode,BuildMachineOSBuild,DTCompiler). - Architectures (Mach-O) — parses fat / universal headers directly to list every slice (
arm64,arm64e/arm64e.x1with PAC indicator,x86_64,i386,ppc…), with bit width, slice size, fat offset, declaredminosand build SDK. Universal binaries split into independentUniversal · arm64 · x86_64tags in the header. - Document types — card list of
CFBundleDocumentTypes(role badge, extensions, UTIs, handler rank, icon file) with an embedded scroll view when the list grows past 6 entries. - URL Schemes, Exported / Imported UTIs, NSServices.
- Privacy (TCC usage descriptions) — every
NS***UsageDescriptionkey is mapped to a friendly title and SF Symbol, with a generic fallback for unknown keys. - Network security / Electron —
NSAppTransportSecurityexception domains,ElectronAsarIntegrityhashes. - Quarantine — reads
com.apple.quarantineviagetxattr, decodes flags / agent / download-event UUID / hex timestamp into a date, and offers a Copy remove command button — thexattr -dline goes to your clipboard so you can run it in Terminal yourself (SwiftLens stays sandboxed and never mutates other apps). - Extended attributes — full
listxattrenumeration; binary values (e.g.com.apple.macl) shown as hex. - Code signing — Security framework only. Basic and strict recursive checks cover every architecture and report failing
OSStatusvalues. Signature validity, certificate-based distribution, and notarization are shown separately; detecting a stapled ticket does not verify it. Includes certificates, fingerprints, CDHash, flags, secure signing timestamps, designated requirements, and commands for manual verification. - Entitlements — parsed key/value list plus the raw XML plist and a Copy Entitlements XML button; top row highlights
com.apple.security.app-sandbox, and high-risk entitlements (disable-library-validation, allow-unsigned-executable-memory, DYLD env, get-task-allow, debugger, JIT, executable page protection, temporary exceptions) are flagged with warning icons and explanations. - Embedded sub-bundles — scans
Frameworks/,EmbeddedFrameworks/,SharedFrameworks/,SystemFrameworks/,PlugIns/,XPCServices/,Helpers/,Extensions/,Library/LoginItems/,Library/SystemExtensions/,Library/LaunchServices/,Library/Spotlight/,Library/QuickLook/,Library/Automator/, including framework-styleVersions/A/Resources/Info.plistlayouts. Each entry now reports BundleID / version / signature state / basic & strict validity / TeamID / architectures / Runtime Version, plusNSExtensionPointIdentifier/NSExtensionPrincipalClassandXPCServicetype / run loop. TeamID mismatches, invalid signatures, strict failures and architectures missing from the main app are flagged. - Mach-O dependencies — Read dylib load commands and
LC_RPATHper slice, including reference type, current and compatibility versions, and the resolved path and RPATH. System paths are reported separately as shared-cache candidates. - Privacy manifests & App Store receipt — scans the main bundle, sub-bundles and iOS Wrapper for
PrivacyInfo.xcprivacy, showing accessed API categories with reason codes, collected data types, tracking domains andNSPrivacyTracking; detectsContents/_MASReceipt/receipt. - Launch Agents / Daemons — lists
Contents/Library/LaunchAgentsandLaunchDaemonsplists with theirLabel. - Sparkle auto-update —
SUFeedURL,SUPublicEDKey,SUPublicDSAKeyFile, plus allSUEnable*/SUScheduled*switches (with seconds ↔ days conversion). - AppleScript / Siri / Intents —
NSAppleScriptEnabled,OSAScriptingDefinition,NSUserActivityTypes,INIntentsSupported,SFSafariCorrespondingIOSAppBundleIdentifier. - iCloud —
NSUbiquitousContainersexpanded per container (each identifier serves as the section header so multi-container apps actually show the correct count). - Notifications —
NSUserNotificationAlertStyleand the three usage-description variants. - Misc switches — sudden / automatic termination,
LSRequiresCarbon,LSRequiresNativeExecution,LSMultipleInstancesProhibited,LSFileQuarantineEnabled,GPUEjectPolicy/GPUSelectionPolicy,ITSAppUsesNonExemptEncryption. - Help / localization / Accent / Spotlight —
CFBundleHelpBookName/Folder,CFBundleLocalizationsmerged with an actualContents/Resources/*.lprojscan (most apps omit the plist key),NSAccentColorName,MDItemKeywords. - iOS port fields —
UIDeviceFamily,UILaunchStoryboardName,UIRequiresFullScreen,UISupportedInterfaceOrientations,UIStatusBarStyle,UIBackgroundModes,ASWebAuthenticationSession…. iOS-port apps with theWrapper/<name>.app/layout are parsed correctly. - Electron / build metadata / vendor —
ElectronTeamID,SourceVersion,requiredBuildHash,SCMRevision,AppIdentifierPrefix,CFBundleSpokenName,VendorCode,OrganizationIdentifier,CTFontSuppressAutoDownload. - Bonjour —
NSBonjourServicesshown verbatim (no over-eager_…._tcpre-wrapping). - File info — recursive bundle size, modification / creation dates, octal permissions, App Store receipt, and a Size Breakdown by top-level
Contentsdirectory with percentages. - Info.plist health — actual plist path, XML / Binary format, missing required keys, main executable presence and
_CodeSignatureresources, plusLSMinimumSystemVersionByArchitecture. - Version comparison window — Open with
⌘⇧DorMore ▸ Compare Versions…. Pick or drop two.appbundles. Identity scoring considers bundle ID, signing identity, names and embedded structure, with a manual override for uncertain pairs. Compare exact byte counts, typed plist and entitlement values, dependencies by architecture, privacy declarations, launch items, and files by relative path. SHA-256 identifies content changes even when file size is unchanged. - File tree — an expandable bundle tree with folder sizes aggregated recursively, standard folders sorted first and every classic path annotated with a role badge plus an ⓘ tooltip. Can be hidden from
More ▸ Show file treeor Settings, and the choice is remembered. Very large bundles cap the visible tree at 4,000 nodes while keeping exact sizes. - Classic structure help tab —
Help ▸ Bundle Structuredocuments every standard item in three groups (container & code, signature & metadata, resources & privacy):Contents/Info.plist,MacOS/<CFBundleExecutable>,Resources,Frameworks,SharedFrameworks,PlugIns,XPCServices,Library,_CodeSignature/CodeResources,PkgInfo,embedded.provisionprofile,PrivacyInfo.xcprivacy,*.lproj,Assets.car,*.icns,_MASReceipt/receiptand the iOSWrapper/layout. - Raw
Info.plist(full flattened key/value dump) and synthesizedcodesign -dvvvoutput for debugging. PlistBoolvalues now render asYES/NOinstead of1/0. - Search & export —
⌘Fsearches metadata and paths across the bundle, including files omitted from the file tree. Results can jump to report sections or reveal files in Finder. Copy the inspection report as JSON (also available with--jsonin the CLI) or copy the entitlement XML. - Recent apps —
More ▸ Recent Apps(second-level menu) keeps up to 10 apps with a live validity marker (valid / missing / invalid); click to reopen, remove a single entry, or clear all. Enabled by default in Settings and can be turned off; uses security-scoped bookmarks so read-only access survives relaunch. - Help sheet — explains every header badge (signing distribution and notarization, sandbox, quarantine, validity, strict validity, agent / background / iOS port) and how to interpret them; open it from
More ▸ Helpor the menu⌘?. - Native Settings window — standard macOS
Settingsscene with General / Recent Apps tabs: language (Follow system / 中文 / English), theme, and recent-apps recording (on by default), persisted via@AppStorage. - Standard About panel — macOS About panel with app icon, version / build, copyright, and clickable Repository / License links.
- Open with SwiftLens — other apps (or Finder's Open With) can hand a
.appto SwiftLens through a LaunchServices open-file event, e.g.NSWorkspace.shared.open([url], withApplicationAt: swiftLensURL, configuration:). No URL scheme is involved, so the sandbox still grants read access to the target bundle and it loads into the single window. - Hidden CLI mode —
swift run SwiftLens /path/to.appprints a full localized plain-text summary and exits;--jsonoutputs a structured JSON report. Useful for scripting.
SwiftLens ships with these entitlements:
com.apple.security.app-sandbox = true
com.apple.security.files.user-selected.read-only = true
com.apple.security.files.bookmarks.app-scope = trueThat means:
- It cannot spawn
codesign,spctl,xattr,spctlor any other subprocess. - It can read whatever file the user drops in via the open panel / drag-and-drop (
SecStaticCodeCheckValidity,getxattr,listxattrall work under the sandbox), but it cannot mutate other apps' bundles. - Recent apps use security-scoped bookmarks (read-only) so they can be reopened after a relaunch; this is still the standard App Sandbox model and does not grant write access.
- Removing
com.apple.quarantineis therefore exposed as a Copy command button, not a destructive action.
- macOS 15.0+
- Xcode 27.x (for the bundled Xcode project) or just the Swift 6.0+ toolchain (for SPM)
swift run SwiftLens # launches the GUI
swift run SwiftLens /Applications/Safari.app # CLI summary modeThe repository includes SwiftLens.xcodeproj, generated with xcodegen from project.yml. To regenerate after adding or removing source files:
xcodegen generate
open SwiftLens.xcodeprojBoth build paths compile the same sources under Sources/SwiftLens/.
SwiftLens/
├─ Package.swift # SPM manifest
├─ project.yml # xcodegen config (Xcode project source of truth)
├─ SwiftLens.xcodeproj/ # generated Xcode project (kept in git)
├─ SwiftLens/
│ ├─ Info.plist
│ ├─ SwiftLens.entitlements # app-sandbox + read-only user file access + bookmarks
│ └─ Assets.xcassets/
│ └─ AppIcon.appiconset/
└─ Sources/SwiftLens/
├─ SwiftLensApp.swift # @main App + AppDelegate (CLI mode + Dock focus fix)
├─ AppState.swift # language / theme / recent apps persistence
├─ L10n.swift # runtime zh/en string table (live switch)
├─ SettingsView.swift # native Settings window (General / Recent Apps)
├─ AppMeta.swift # app metadata + standard About panel
├─ HelpView.swift # help sheet (badge legend)
├─ ContentView.swift # drag-and-drop shell + loading overlay (race-safe)
├─ DetailView.swift # all info sections + header badges + Badge view
├─ SharedViews.swift # RowView / SectionView / PlaceholderRow
├─ AppInfo.swift # aggregated model + loader
├─ InfoPlistParser.swift # Info.plist parse + flatten (CFBoolean-aware)
├─ QuarantineReader.swift # com.apple.quarantine read (incl. UUID)
├─ ExtendedXattrReader.swift # full xattr enumeration
├─ ArchitectureReader.swift # Mach-O / fat header parse (arm64e / PAC aware)
├─ MachODependencyReader.swift # LC_LOAD_DYLIB / LC_RPATH + @rpath resolution
├─ CodeSignReader.swift # Security-framework-only: SecStaticCodeCheckValidity
│ # (kSecCSStrictValidate | kSecCSCheckAllArchitectures)
│ # + SecCodeCopySigningInformation
├─ SubBundleScanner.swift # Frameworks / SharedFrameworks / Helpers / XPC /
│ # PlugIns / Extensions / Library scans
├─ PrivacyReader.swift # TCC usage-description catalog
├─ PrivacyManifestReader.swift # PrivacyInfo.xcprivacy + MAS receipt
└─ ExtraInfoReader.swift # Sparkle / AppleScript / iCloud / Bonjour / ...
MIT — see LICENSE. Source code is provided as-is.
Inspired by Bilibili creator 小调mac实验室.
中文版说明:README.zh-CN.md
