Skip to content

Instantly share code, notes, and snippets.

@Reiss-Cashmore
Created February 19, 2023 22:35
Show Gist options
  • Save Reiss-Cashmore/883b111bc3f651dc08db210d4e564106 to your computer and use it in GitHub Desktop.
Save Reiss-Cashmore/883b111bc3f651dc08db210d4e564106 to your computer and use it in GitHub Desktop.
disable.sh
#!/bin/zsh
#Credit: Original idea and script disable.sh by pwnsdx https://gist.github.com/pwnsdx/d87b034c4c0210b988040ad2f85a68d3
#*****Work in progress*****
#Disabling unwanted services on macOS 11 Big Sur
#Modifications written in /private/var/db/com.apple.xpc.launchd/ disabled.plist, disabled.501.plist & disabled.205.plist
#Disabling SIP might not be required, still testing.
sudo mkdir mnt
sudo mount -o nobrowse -t apfs /dev/disk1s5 mnt/
# Disable telemetry home
# echo 127.0.0.1 ocsp.apple.com | sudo tee -a /etc/hosts
# echo ::1 ocsp.apple.com | sudo tee -a /etc/hosts
# user
TODISABLE=()
TODISABLE+=('com.apple.accessibility.MotionTrackingAgent' \
'com.apple.AMPArtworkAgent' \
'com.apple.AMPDeviceDiscoveryAgent' \
'com.apple.AMPLibraryAgent' \
'com.apple.ap.adprivacyd' \
'com.apple.ap.adservicesd' \
'com.apple.ap.promotedcontentd' \
'com.apple.assistant_service' \
'com.apple.assistantd' \
'com.apple.avconferenced' \
'com.apple.BiomeAgent' \
'com.apple.biomesyncd' \
'com.apple.CalendarAgent' \
'com.apple.cloudd' \
'com.apple.cloudpaird' \
'com.apple.cloudphotod' \
'com.apple.CloudPhotosConfiguration' \
'com.apple.CommCenter-osx' \
'com.apple.ContactsAgent' \
'com.apple.CoreLocationAgent' \
'com.apple.familycircled' \
'com.apple.familycontrols.useragent' \
'com.apple.familynotificationd' \
'com.apple.followupd' \
'com.apple.gamed' \
'com.apple.geod' \
'com.apple.homed' \
'com.apple.icloud.findmydeviced' \
'com.apple.icloud.findmydeviced.aps-demo' \
'com.apple.icloud.findmydeviced.aps-development' \
'com.apple.icloud.findmydeviced.aps-production' \
'com.apple.icloud.findmydeviced.findmydevice-user-agent' \
'com.apple.icloud.findmydeviced.ua-services' \
'com.apple.icloud.fmfd' \
'com.apple.icloud.searchpartyd' \
'com.apple.icloud.searchpartyd.accessorydiscoverymanager' \
'com.apple.icloud.searchpartyd.advertisementcache' \
'com.apple.icloud.searchpartyd.beaconmanager' \
'com.apple.icloud.searchpartyd.beaconmanager.agentdaemoninternal' \
'com.apple.icloud.searchpartyd.finderstatemanager' \
'com.apple.icloud.searchpartyd.pairingmanager' \
'com.apple.icloud.searchpartyd.scheduler' \
'com.apple.icloud.searchpartyuseragent' \
'com.apple.iCloudNotificationAgent' \
'com.apple.iCloudUserNotifications' \
'com.apple.imagent' \
'com.apple.imautomatichistorydeletionagent' \
'com.apple.imtransferagent' \
'com.apple.itunescloudd' \
'com.apple.knowledge-agent' \
'com.apple.ManagedClient.cloudconfigurationd' \
'com.apple.ManagedClientAgent.enrollagent' \
'com.apple.Maps.mapspushd' \
'com.apple.Maps.pushdaemon' \
'com.apple.mediaanalysisd' \
'com.apple.mediastream.mstreamd' \
'com.apple.newsd' \
'com.apple.parsec-fbf' \
'com.apple.parsecd' \
'com.apple.passd' \
'com.apple.photoanalysisd' \
'com.apple.photolibraryd' \
'com.apple.progressd' \
'com.apple.protectedcloudstorage.protectedcloudkeysyncing' \
'com.apple.rapportd-user' \
'com.apple.remindd' \
'com.apple.routined' \
'com.apple.SafariCloudHistoryPushAgent' \
'com.apple.SafeEjectGPUAgent' \
'com.apple.screensharing.agent' \
'com.apple.screensharing.menuextra' \
'com.apple.screensharing.MessagesAgent' \
'com.apple.ScreenTimeAgent' \
'com.apple.security.cloudkeychainproxy3' \
'com.apple.sidecar-hid-relay' \
'com.apple.sidecar-relay' \
'com.apple.Siri.agent' \
'com.apple.siri.context.service' \
'com.apple.siriknowledged' \
'com.apple.suggestd' \
'com.apple.telephonyutilities.callservicesd' \
'com.apple.TMHelperAgent' \
'com.apple.TMHelperAgent.SetupOffer' \
'com.apple.UsageTrackingAgent' \
'com.apple.videosubscriptionsd' \
'com.apple.wifi.WiFiAgent')
for agent in "${TODISABLE[@]}"
do
launchctl bootout gui/501/${agent}
launchctl disable gui/501/${agent}
done
# system
TODISABLE=()
TODISABLE+=('com.apple.airportd' \
'com.apple.bootpd' \
'com.apple.cloudd' \
'com.apple.cloudpaird' \
'com.apple.cloudphotod' \
'com.apple.CloudPhotosConfiguration' \
'com.apple.CoreLocationAgent' \
'com.apple.coreduetd' \
'com.apple.dhcp6d' \
'com.apple.diagnosticextensions.osx.wifi.helper' \
'com.apple.familycontrols' \
'com.apple.findmymacmessenger' \
'com.apple.followupd' \
'com.apple.FollowUpUI' \
'com.apple.ftp-proxy' \
'com.apple.ftpd' \
'com.apple.GameController.gamecontrollerd' \
'com.apple.icloud.findmydeviced' \
'com.apple.icloud.findmydeviced.aps-demo' \
'com.apple.icloud.findmydeviced.aps-development' \
'com.apple.icloud.findmydeviced.aps-production' \
'com.apple.icloud.findmydeviced.findmydevice-user-agent' \
'com.apple.icloud.findmydeviced.ua-services' \
'com.apple.icloud.fmfd' \
'com.apple.icloud.searchpartyd' \
'com.apple.icloud.searchpartyd.accessorydiscoverymanager' \
'com.apple.icloud.searchpartyd.advertisementcache' \
'com.apple.icloud.searchpartyd.beaconmanager' \
'com.apple.icloud.searchpartyd.beaconmanager.agentdaemoninternal' \
'com.apple.icloud.searchpartyd.finderstatemanager' \
'com.apple.icloud.searchpartyd.pairingmanager' \
'com.apple.icloud.searchpartyd.scheduler' \
'com.apple.icloud.searchpartyuseragent' \
'com.apple.iCloudHelper' \
'com.apple.iCloudNotificationAgent' \
'com.apple.iCloudUserNotificationsd' \
'com.apple.itunescloudd' \
'com.apple.ManagedClient.cloudconfigurationd' \
'com.apple.netbiosd' \
'com.apple.protectedcloudstorage.protectedcloudkeysyncing' \
'com.apple.rapportd' \
'com.apple.screensharing' \
'com.apple.security.cloudkeychainproxy3' \
'com.apple.siri.morphunassetsupdaterd' \
'com.apple.siriinferenced' \
'com.apple.wifianalyticsd' \
'com.apple.wifiFirmwareLoader' \
'com.apple.wifip2pd' \
'com.apple.wifivelocityd')
for daemon in "${TODISABLE[@]}"
do
sudo launchctl bootout system/${daemon}
sudo launchctl disable system/${daemon}
done
#location
sudo launchctl bootout user/205/com.apple.geod
sudo launchctl disable user/205/com.apple.geod
# --------------------------- AGENTS to disable -------------
TODISABLE=()
TODISABLE+=(
# --------------------- CLOUD -------------------------
'com.apple.cloudd' \
'com.apple.cloudpaird' \
'com.apple.cloudphotod' \
'com.apple.cloudphotosd' \
'com.apple.followupd' \
'com.apple.icloud.searchpartyuseragent' \
'com.apple.icloud' \
'com.apple.iCloudNotificationAgent' \
'com.apple.iCloudUserNotifications' \
'com.apple.itunescloudd' \
'com.apple.protectedcloudstorage.protectedcloudkeysyncing' \
'com.apple.webinspectord' \
'com.apple.security.cloudkeychainproxy3' \
# -------------------- SAFARI ---------------------
'com.apple.Safari.SafeBrowsing.Service' \
'com.apple.SafariBookmarksSyncAgent' \
'com.apple.SafariCloudHistoryPushAgent' \
'com.apple.safaridavclient' \
'com.apple.SafariHistoryServiceAgent' \
'com.apple.SafariLaunchAgent' \
'com.apple.SafariNotificationAgent' \
'com.apple.SafariPlugInUpdateNotifier' \
'com.apple.swcd' \
'com.apple.WebKit.PluginAgent' \
'com.apple.Safari.PasswordBreachAgent' \
# -------------------- ADD RELATED ---------------------------
'com.apple.ap.adprivacyd' \
'com.apple.ap.adservicesd' \
'com.apple.ap.promotedcontentd' \
# ------------------- Game Center / Passbook / Apple TV / Homekit...
'com.apple.gamed' \
'com.apple.passd' \
'com.apple.Maps.pushdaemon' \
'com.apple.videosubscriptionsd' \
'com.apple.homed' \
# -------------------- SIRI ---------------------------
'com.apple.assistant_service' \
'com.apple.assistantd' \
'com.apple.parsec-fbf' \
'com.apple.siri-distributed-evaluation' \
'com.apple.Siri.agent' \
'com.apple.siri.context.service' \
'com.apple.siriknowledged' \
# -------------------- Screensharing ---------------------------
#'com.apple.screensharing.MessagesAgent' \
#'com.apple.screensharing.agent' \
#'com.apple.screensharing.menuextra' \
# -------------------- Sidecar --------------
'com.apple.sidecar-hid-relay' \
'com.apple.sidecar-relay' \
# -------------------- Screentime -------------
'com.apple.ScreenTimeAgent' \
'com.apple.UsageTrackingAgent' \
# --------------------Family Parent Control ---------------------
'com.apple.familycircled' \
'com.apple.familycontrols.useragent' \
'com.apple.familynotificationd' \
'com.apple.parentalcontrols.check' \
# --------------------Classroom -------------------------------
'com.apple.progressd' \
# --------------------Spotlight------------------------------
#'com.apple.corespotlightd' \
#'com.apple.corespotlightservice' \
#'com.apple.Spotlight' \
#'com.apple.metadata.mdwrite' \
#'com.apple.metadata.mdbulkimport' \
#'com.apple.metadata.mdflagwriter' \
#'com.apple.mdworker.mail' \
#'com.apple.mdmclient.agent' \
#'com.apple.mdworker.shared' \
#'com.apple.mdworker.sizing' \
#'com.apple.mdworker.single.plist' \
#'com.apple.mdworker.single.arm64' \
#'com.apple.mdworker.single.x86_64' \
#'com.apple.mdworker.sizing' \
#'com.apple.mdworker.bundles' \
# -------------------- iMessage / Facetime
#'com.apple.avconferenced' \
#'com.apple.findmymacmessenger' \
#'com.apple.imagent' \
#'com.apple.imautomatichistorydeletionagent' \
#'com.apple.imklaunchagent' \
#'com.apple.imtransferagent' \
# --------------------Others ---------------------------
'com.apple.macos.studentd' \
'com.apple.photoanalysisd' \
'com.apple.photolibraryd' \
'com.apple.PhotoLibraryMigrationUtility.XPC' \
'com.apple.podcasts.PodcastContentService' \
'com.apple.softwareupdate_notify_agent' \
'com.apple.SoftwareUpdateNotificationManager' \
#'com.apple.suggestd' \
#'com.apple.syncdefaultsd' \
'com.apple.UsageTrackingAgent' \
'com.apple.identityservicesd' \
'com.apple.touristd' \
#'com.apple.appstoreagent' \
#'com.apple.storedownloadd'
)
sudo mkdir mnt/System/Library/LaunchAgents/OldPlist
for agent in "${TODISABLE[@]}"
do
sudo mv mnt/System/Library/LaunchAgents/${agent}.plist mnt/System/Library/LaunchAgents/OldPlist/${agent}.plist.bak
echo "[OK] Agent ${agent} disabled"
done
# ---------------------------- DAEMONS to disable --------------------------------------
TODISABLE=()
# iCloud
TODISABLE+=(
# --------------------- CLOUD -------------------------
'com.apple.analyticsd' \
'com.apple.cloudd' \
'com.apple.iCloudStats' \
'com.apple.icloud.searchpartyd'
# ---------------------Spotlight
#'com.apple.metadata.mds.index' \
#'com.apple.metadata.mds' \
#'com.apple.metadata.mds.spindump' \
#'com.apple.metadata.mds.scan' \
# --------------------- Others
'com.apple.appleseed.fbahelperd' \
'com.apple.familycontrols' \
'com.apple.findmymac' \
'com.apple.findmymacmessenger' \
'com.apple.locate' \
'com.apple.locationd' \
#'com.apple.metadata.mds.index' \
#'com.apple.metadata.mds.scan' \
#'com.apple.metadata.mds.spindump' \
#'com.apple.metadata.mds' \
'com.apple.SubmitDiagInfo' \
'com.apple.mobile.softwareupdated' \
'com.apple.softwareupdated' \
'com.apple.siriinferenced'
)
sudo mkdir mnt/System/Library/LaunchDaemons/OldPlist
for daemon in "${TODISABLE[@]}"
do
sudo mv mnt/System/Library/LaunchDaemons/${daemon}.plist mnt/System/Library/LaunchDaemons/OldPlist/${daemon}.plist.bak
echo "[OK] Daemon ${daemon} disabled"
done
#----------------------- REMOVE APPS ------------------------------------
sudo rm -rf ~/mnt/System/Applications/Chess.app
sudo rm -rf ~/mnt/System/Applications/FaceTime.app
sudo rm -rf ~/mnt/System/Applications/Home.app
sudo rm -rf ~/mnt/System/Applications/Maps.app
sudo rm -rf ~/mnt/System/Applications/Messages.app
sudo rm -rf ~/mnt/System/Applications/News.app
sudo rm -rf ~/mnt/System/Applications/Photo\ Booth.app
sudo rm -rf ~/mnt/System/Applications/Photos.app
sudo rm -rf ~/mnt/System/Applications/Podcasts.app
sudo rm -rf ~/mnt/System/Applications/Siri.app
sudo rm -rf ~/mnt/System/Applications/Stickies.app
sudo rm -rf ~/mnt/System/Applications/Stocks.app
sudo rm -rf ~/mnt/System/Applications/TV.app
sudo rm -rf ~/mnt/System/Applications/VoiceMemos.app
sudo rm -rf ~/mnt/System/Applications/QuickTime\ Player.app
# -----------------------------------------------------------------
# Mission Control
defaults write com.apple.dock mcx-expose-disabled -bool TRUE
#defaults delete com.apple.dock mcx-expose-disabled
# Dashboard
defaults write com.apple.dashboard mcx-disabled -bool TRUE
#defaults delete com.apple.dashboard mcx-disabled
# Spotlight
#sudo mdutil -a -i off
#sudo chmod 0 mnt/System/Library/CoreServices/Spotlight.app
#sudo mdutil -a -i on
#sudo chmod 755 mnt/System/Library/CoreServices/Spotlight.app
# ------------------------ REMOVE OTHER STUFF ---------------------------
# Sometime MRT.app goes 120% CPU Time , both of them --------------------
sudo mv mnt/Library/Apple/System/Library/CoreServices/MRT.app mnt/Library/Apple/System/Library/CoreServices/MRT.back
sudo mv mnt/System/Library/Templates/Data/Library/Apple/System/Library/CoreServices/MRT.app mnt/System/Library/Templates/Data/Library/Apple/System/Library/CoreServices/MRT.back
killall Dock
sudo bless --folder mnt/System/Library/CoreServices --bootefi --create-snapshot && sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment