package simslim import "sort" // Category groups launchd daemon labels that a slim boot disables together. type Category struct { ID string `json:"id"` Name string `json:"name"` Description string `json:"description"` Downside string `json:"downside"` ApproxMemoryMB int `json:"approxMemoryMB"` Labels []string `json:"labels"` ServiceDescriptions map[string]string `json:"serviceDescriptions"` AlwaysEnabled []AlwaysEnabledService `json:"alwaysEnabled,omitempty"` } // AlwaysEnabledService is shown alongside a category for transparency but is // never included in a slim profile. Earlier versions may have disabled it, so // it remains in the mutation allowlist solely to repair that legacy state. type AlwaysEnabledService struct { Label string `json:"label"` Reason string `json:"reason"` } // Categories is the complete allowlist of daemons a profile may disable. // Categories may overlap: a label lives in every category whose feature needs // it, and an excepted category keeps all its labels enabled even when a // slimmed category also lists them. // ApproxMemoryMB values are rounded median increases in phys_footprint when // only that category is kept on versus a fully slim iOS 26.5 clean boot. The // estimates vary by runtime and workload and are not additive. var Categories = []Category{ { ID: "widgets", Name: "Widgets & Wallpaper", Description: "Home and lock screen posters, widgets, and Live Activities.", Downside: "Home and Lock Screen widgets, wallpaper posters, and Live Activities stop updating.", ApproxMemoryMB: 675, Labels: []string{ "com.apple.PosterBoard", "com.apple.chronod", "com.apple.liveactivitiesd", // chronod runs the stock Maps widget, which retries its navd // connection in a tight loop while navd is down and floods the // unified log; shared with the connectivity category. "com.apple.navd", }, }, { ID: "siri", Name: "Siri & Intelligence", Description: "Siri, Apple Intelligence, speech, and on-device ML model services.", Downside: "Siri, speech features, and Apple Intelligence services are unavailable.", ApproxMemoryMB: 265, Labels: []string{ "com.apple.assistant_cdmd", "com.apple.assistant_service", "com.apple.siriactionsd", "com.apple.siriinferenced", "com.apple.siriknowledged", "com.apple.sirittsd", "com.apple.siri.context.service", "com.apple.siri.acousticsignature", "com.apple.corespeechd", "com.apple.voiced", "com.apple.voicebankingd", "com.apple.speechmodeltrainingd", "com.apple.intelligenceplatformd", "com.apple.intelligencecontextd", "com.apple.intelligenceflowd", "com.apple.intelligencetasksd", "com.apple.generativeexperiencesd", "com.apple.knowledgeconstructiond", "com.apple.naturallanguaged", "com.apple.textunderstandingd", "com.apple.modelcatalogd", "com.apple.modelmanagerd", "com.apple.mlhostd", "com.apple.mlruntimed", "com.apple.suggestd", "com.apple.parsecd", "com.apple.parsec-fbf", "com.apple.proactiveeventtrackerd", }, AlwaysEnabled: []AlwaysEnabledService{ { Label: "com.apple.assistantd", Reason: "Hosts the dictation service; without it the system Spotlight app leaks memory.", }, }, }, { ID: "search", Name: "Spotlight & Search", Description: "On-device Spotlight and in-Settings search services.", Downside: "Spotlight and Settings search return no results, and Recents in Files and the document picker fails to load.", ApproxMemoryMB: 50, Labels: []string{ "com.apple.searchd", "com.apple.searchtoold", "com.apple.spotlightknowledged", "com.apple.spotlightknowledged.updater", "com.apple.corespotlightservice", }, }, { ID: "icloud", Name: "iCloud & Apple Account", Description: "iCloud sync, Apple Account, keychain, and backup services.", Downside: "iCloud sync, Apple Account, Keychain, and backup workflows will not work.", ApproxMemoryMB: 100, Labels: []string{ "com.apple.appleaccountd", "com.apple.appleaccounttransparencyd", "com.apple.appleidsetupd", "com.apple.akd", "com.apple.amsaccountsd", "com.apple.amsengagementd", "com.apple.amsondevicestoraged", "com.apple.cloudd", "com.apple.cloudphotod", "com.apple.ckdiscretionaryd", "com.apple.cloudsettingssyncagent", "com.apple.bird", "com.apple.syncdefaultsd", "com.apple.cdpd", "com.apple.sosd", "com.apple.SecureBackupDaemon", "com.apple.TrustedPeersHelper", "com.apple.protectedcloudstorage.protectedcloudkeysyncing", "com.apple.icloudmailagent", "com.apple.icloudsubscriptionoptimizerd", "com.apple.communicationtrustd", }, }, { ID: "store", Name: "App Store, Push & Media", Description: "App Store, push notification, StoreKit, and media services.", Downside: "Remote push notifications and StoreKit or App Store testing will not work.", ApproxMemoryMB: 80, Labels: []string{ "com.apple.appstored", "com.apple.appstorecomponentsd", "com.apple.apsd", "com.apple.itunescloudd", "com.apple.itunesstored", "com.apple.storekitd", // Apple Media Services renders the in-app purchase payment // sheet; these three are shared with the icloud category. "com.apple.amsaccountsd", "com.apple.amsengagementd", "com.apple.amsondevicestoraged", // Wallet hosts the payment authorization sheet and needs the // Finance datastore; both shared with the other category. "com.apple.passd", "com.apple.financed", "com.apple.videosubscriptionsd", "com.apple.assetsubscriptiond", "com.apple.musicd", }, }, { ID: "pim", Name: "Mail, Calendar & Contacts", Description: "Mail, Calendar, Contacts, Reminders, and related sync services.", Downside: "Contacts, Calendar, Reminders, and Mail-backed pickers or sync may fail.", ApproxMemoryMB: 80, Labels: []string{ "com.apple.email.maild", "com.apple.exchangesyncd", "com.apple.dataaccess.dataaccessd", "com.apple.calaccessd", "com.apple.remindd", "com.apple.contactsd", "com.apple.contacts.postersyncd", "com.apple.peopled", }, }, { ID: "web", Name: "Safari Sync & Web Services", Description: "Safari sync, web push, privacy, and universal-link services.", Downside: "Universal links and Safari sync or background web services will not work.", ApproxMemoryMB: 50, Labels: []string{ "com.apple.SafariBookmarksSyncAgent", "com.apple.Safari.History", "com.apple.Safari.passwordbreachd", "com.apple.Safari.SafeBrowsing.Service", "com.apple.safarifetcherd", "com.apple.WebBookmarks.webbookmarksd", "com.apple.webkit.adattributiond", "com.apple.webkit.webpushd", "com.apple.webprivacyd", "com.apple.swcd", }, }, { ID: "family", Name: "Family & Screen Time", Description: "Family Sharing, Screen Time, and usage tracking.", Downside: "Family Sharing, Screen Time, and usage tracking stop working.", ApproxMemoryMB: 65, Labels: []string{ "com.apple.familycircled", "com.apple.FamilyControlsAgent", "com.apple.familynotification", "com.apple.askpermissiond", "com.apple.asktod", "com.apple.ScreenTimeAgent", "com.apple.ScreenTimeSettingsAgent", "com.apple.UsageTrackingAgent", }, }, { ID: "health", Name: "Health, Home & Fitness", Description: "HealthKit, HomeKit, and Fitness services.", Downside: "HealthKit, HomeKit, and Fitness integrations will not work.", ApproxMemoryMB: 135, Labels: []string{ "com.apple.healthd", "com.apple.healthappd", "com.apple.healthcontentd", "com.apple.healtheventsd", "com.apple.healthrecordsd", "com.apple.finhealthd", "com.apple.homed", "com.apple.homeeventsd", "com.apple.fitcore", "com.apple.fitcore.session", "com.apple.fitnesscoachingd", "com.apple.fitnessintelligenced", "com.apple.activityawardsd", "com.apple.activitysharingd", }, }, { ID: "photos", Name: "Photos & Media Analysis", Description: "Photos library, photo analysis, and media analysis services.", Downside: "Photo picker, Photos-library workflows, and media analysis may fail.", ApproxMemoryMB: 60, Labels: []string{ "com.apple.photoanalysisd", "com.apple.photosface", "com.apple.mediaanalysisd", "com.apple.mediaanalysisd.service", "com.apple.mediastream.mstreamd", "com.apple.medialibraryd", "com.apple.assetsd", "com.apple.assetsd.nebulad", }, }, { ID: "apps", Name: "News, Weather, Maps & Games", Description: "News, Weather, Maps, Tips, and game services.", Downside: "News, Weather, Maps background data, and game-controller services are unavailable.", ApproxMemoryMB: 90, Labels: []string{ "com.apple.newsd", "com.apple.weatherd", "com.apple.Maps.mapssyncd", "com.apple.Maps.mapspushd", "com.apple.Maps.geocorrectiond", "com.apple.maps.destinationd", "com.apple.MapKit.SnapshotService", "com.apple.jetpackassetd", "com.apple.tipsd", "com.apple.gamesaved", "com.apple.GameController.gamecontrollerd", }, AlwaysEnabled: []AlwaysEnabledService{ { Label: "com.apple.gamed", Reason: "Required for timely XCUITest app launches (DTServiceHub / GameKit).", }, }, }, { ID: "messaging", Name: "Messaging & FaceTime", Description: "iMessage, FaceTime, call, and identity services.", Downside: "iMessage, FaceTime, and related identity services will not work.", ApproxMemoryMB: 60, Labels: []string{ "com.apple.identityservicesd", "com.apple.ids_simd", "com.apple.imautomatichistorydeletionagent", "com.apple.imcore.imtransferagent", "com.apple.imdpersistence.IMDPersistenceAgent", "com.apple.facetimemessagestored", "com.apple.telephonyutilities.callservicesd", }, }, { ID: "connectivity", Name: "Sharing & Device Connectivity", Description: "AirDrop, Continuity, CarPlay, Watch, and Find My services.", Downside: "AirDrop, Continuity, CarPlay, Watch, and Find My connectivity will not work.", ApproxMemoryMB: 65, Labels: []string{ "com.apple.rapportd", "com.apple.companiond", "com.apple.carkitd", "com.apple.wcd", "com.apple.tvremoted", "com.apple.avatarsd", "com.apple.stickersd", "com.apple.sociallayerd", "com.apple.announced", "com.apple.navd", "com.apple.findmy.findmylocated", }, AlwaysEnabled: []AlwaysEnabledService{ { Label: "com.apple.sharingd", Reason: "Required for system share sheets.", }, }, }, { ID: "telemetry", Name: "Ads, Diagnostics & Telemetry", Description: "DeviceCheck, ad privacy, analytics, diagnostics, and feedback services.", Downside: "DeviceCheck plus analytics, diagnostics, and feedback services are unavailable.", ApproxMemoryMB: 105, Labels: []string{ "com.apple.ap.adprivacyd", "com.apple.ap.promotedcontentd", "com.apple.diagnosticextensionsd", "com.apple.feedbackd", "com.apple.rtcreportingd", "com.apple.securityuploadd", "com.apple.geoanalyticsd", "com.apple.triald", "com.apple.followupd", "com.apple.purplebuddy.budd", "com.apple.devicecheckd", }, }, { ID: "mdm", Name: "Device Management", Description: "Declarative device management and managed asset services.", Downside: "Declarative device management, and MDM or configuration-profile workflows that use it, will not work.", ApproxMemoryMB: 10, Labels: []string{ "com.apple.remotemanagementd", "com.apple.RemoteManagementAgent", "com.apple.managedassetsd", }, }, { ID: "other", Name: "Other Background Services", Description: "Wallet, App Clips, business services, assets, and miscellaneous background daemons.", Downside: "Wallet, App Clips, accessibility asset downloads, merchant, business, and miscellaneous background services are unavailable.", ApproxMemoryMB: 225, Labels: []string{ "com.apple.financed", "com.apple.passd", "com.apple.merchantd", "com.apple.coreidvd", "com.apple.businessservicesd", "com.apple.deviceaccessd", "com.apple.replicatord", "com.apple.linkd", "com.apple.ind", "com.apple.storagedatad", "com.apple.StatusKitAgent", "com.apple.countryd", "com.apple.mobileassetd", "com.apple.managedconfiguration.passcodenagd", "com.apple.accessibility.axassetsd", "com.apple.ClipServices.clipserviced", }, }, } func CategoryByID(id string) (Category, bool) { for _, c := range Categories { if c.ID == id { return c, true } } return Category{}, false } // slimmableSet is every label a service profile may disable. func SlimmableSet() map[string]bool { set := make(map[string]bool) for _, c := range Categories { for _, l := range c.Labels { set[l] = true } } return set } // managedSet is the complete mutation allowlist. Most labels are slimmable; // required labels may only transition back to enabled for compatibility. func managedSet() map[string]bool { set := SlimmableSet() for _, category := range Categories { for _, service := range category.AlwaysEnabled { set[service.Label] = true } } return set } // Profile selects which managed daemons a slim boot should disable. type Profile struct { ExceptCategories map[string]bool // category IDs to leave fully enabled Keep map[string]bool // individual labels to leave enabled } // desired returns the labels this profile wants disabled. Categories may share // labels, so a label stays enabled when any excepted category lists it. func (p Profile) Desired() map[string]bool { set := SlimmableSet() for _, c := range Categories { if !p.ExceptCategories[c.ID] { continue } for _, l := range c.Labels { delete(set, l) } } for l := range p.Keep { delete(set, l) } return set } // DesiredForDevice applies platform-specific service requirements to a profile. // Desired remains the platform-independent catalog for profile editors. func (p Profile) DesiredForDevice(d Device) map[string]bool { return desiredForDevice(d, p.Desired()) } func desiredForDevice(d Device, desired map[string]bool) map[string]bool { set := make(map[string]bool, len(desired)) for label, disabled := range desired { // watchOS 26.5 re-enables homed after startup, even when launchd // initially honours the override. Keep it enabled rather than report // a full slim that drifts as soon as the Watch finishes starting up. if d.PlatformName() == "watchOS" && label == "com.apple.homed" { continue } // visionOS serves the simulated surroundings as mobile assets. // Without mobileassetd the device boots into a black space: the // Home View icons float in the dark, and apps still launch. if d.PlatformName() == "visionOS" && label == "com.apple.mobileassetd" { continue } set[label] = disabled } return set } // delta returns the launchctl transitions to move from current to desired, // scoped to managed labels. Labels outside managed are never touched: a // non-managed desired label is ignored, and a non-managed label that is already // disabled is left disabled. Empty results mean the device is already correct. func delta(current, desired, managed map[string]bool) (toDisable, toEnable []string) { dis := map[string]bool{} for l := range desired { if managed[l] && !current[l] { dis[l] = true } } en := map[string]bool{} for l := range current { if managed[l] && !desired[l] { en[l] = true } } return keys(dis), keys(en) } func keys(set map[string]bool) []string { out := make([]string, 0, len(set)) for k := range set { out = append(out, k) } sort.Strings(out) return out }