Skip to content

Instantly share code, notes, and snippets.

@junkblocker
Last active April 17, 2024 21:33
Show Gist options
  • Save junkblocker/ae66b724e3893f4cde93e188eeac8b26 to your computer and use it in GitHub Desktop.
Save junkblocker/ae66b724e3893f4cde93e188eeac8b26 to your computer and use it in GitHub Desktop.
Disable bunch of #$!@ in Catalina
#!/bin/bash
############################################################################################
# WARNING: THESE SCRIPTS AND CHANGES ARE NOT MEANT FOR ANYBODY BUT ME.
# RUNNING THESE WILL MESS UP YOUR COMPUTER IN MYSTERIOUS AND USUALLY UNRECOVERABLE WAYS.
############################################################################################
if [[ "$(sw_vers -productVersion)" != 10\.15* ]]; then
echo "This is only meant to run on macOS 10.15.* Catalina" >&2
exit 1
fi
if [[ "${1-}" == "execed" ]]; then
reply=
printf "Are you pretty damn sure you want to run this? (Yes/No) "
read -r reply
if [[ $reply != Yes ]]; then
echo "Needed a Yes to proceed" >&2
exit 1
fi
fi
LC_ALL=C
export LC_ALL
set -o errexit
set -o nounset
set -o pipefail
IFS=$'\n\t'
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
signed_out=false
if [[ -z "$(command -v mas)" && -n "$(command -v brew)" ]]; then
brew install mas
fi
if ! mas signout; then
echo "Could not sign out of the apple store automatically." >&2
else
signed_out=true
fi
if ! $signed_out; then
reply=
while [[ "$reply" != "OK" ]]; do
echo "Please sign out of apple store before proceeding. Type OK when ready or press Ctrl+c to abort."
read -r reply
done
fi
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
if ! csrutil status | grep -q ' disabled.$'; then
echo "System Integrity Protection is enabled. Can not proceed." >&2
exit 1
fi
sudo mount -uw /
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# shellcheck disable=SC2128
full_dir="$(cd "$(dirname "$BASH_SOURCE")" && pwd)"
cd "/Volumes/Macintosh HD"
if [[ "${1-}" != "execed" ]]; then
exec "/Volumes/Macintosh HD${full_dir}/${BASH_SOURCE##*/}" execed
fi
disable() {
local what kind
what="$1"
kind="$2"
cd "/Volumes/Macintosh HD"
# Yes, both without and with sudo - See https://www.chromium.org/developers/how-tos/debugging-on-os-x
launchctl unload -wF "System/Library/Launch${kind}s/${what}.plist" || true
sudo launchctl unload -wF "System/Library/Launch${kind}s/${what}.plist" || true
}
# WARNING: It might disable things that you may not like. Please double check the services in the various TO_DISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to disable
# 'com.apple.speech.speechdatainstallerd' 'com.apple.speech.speechsynthesisd' 'com.apple.speech.synthesisserver' will freeze Edit menus
# 'com.apple.bird' will prevent saving prompt from being shown
AGENTS_TO_DISABLE=()
# iCloud
AGENTS_TO_DISABLE+=(
'com.apple.security.cloudkeychainproxy3'
'com.apple.iCloudUserNotifications'
'com.apple.icloud.findmydeviced.findmydevice-user-agent'
'com.apple.icloud.fmfd'
'com.apple.icloud.searchpartyuseragent'
'com.apple.cloudd'
'com.apple.cloudpaird'
# cloudphotod is the iCloud Photos agent. It is responsible for all iCloud Photos activity.
'com.apple.cloudphotod'
'com.apple.followupd'
'com.apple.protectedcloudstorage.protectedcloudkeysyncing'
)
# Safari useless stuff
AGENTS_TO_DISABLE+=(
'com.apple.SafariBookmarksSyncAgent'
'com.apple.SafariCloudHistoryPushAgent'
# 'com.apple.WebKit.PluginAgent'
)
# iMessage / Facetime
AGENTS_TO_DISABLE+=(
# 'com.apple.imagent'
# 'com.apple.imautomatichistorydeletionagent'
# 'com.apple.imklaunchagent'
# 'com.apple.imtransferagent'
# 'com.apple.avconferenced'
)
# Game Center / Passbook / Apple TV / Homekit...
AGENTS_TO_DISABLE+=(
'com.apple.gamed'
'com.apple.passd'
'com.apple.Maps.pushdaemon'
'com.apple.videosubscriptionsd'
'com.apple.CommCenter-osx'
# homed is a daemon that manages home state and controls HomeKit accessories.
'com.apple.homed'
)
# Ad-related
AGENTS_TO_DISABLE+=(
'com.apple.ap.adprivacyd'
'com.apple.ap.adservicesd'
)
## Screensharing
#AGENTS_TO_DISABLE+=(
# 'com.apple.screensharing.MessagesAgent'
# 'com.apple.screensharing.agent'
# 'com.apple.screensharing.menuextra'
# )
# Siri
AGENTS_TO_DISABLE+=(
'com.apple.siriknowledged'
'com.apple.assistant_service'
'com.apple.assistantd'
'com.apple.siri-distributed-evaluation'
'com.apple.siri.context.service'
'com.apple.Siri.agent'
# parsecd is location-based suggestions for Siri.
'com.apple.parsecd'
'com.apple.parsec-fbf'
'com.apple.knowledge-agent'
)
## VoiceOver / accessibility-related stuff
#AGENTS_TO_DISABLE+=(
# 'com.apple.VoiceOver'
# 'com.apple.voicememod'
# 'com.apple.accessibility.AXVisualSupportAgent'
# 'com.apple.accessibility.dfrhud'
# 'com.apple.accessibility.heard'
# )
# Quicklook
#AGENTS_TO_DISABLE+=(
# 'com.apple.quicklook.ui.helper'
# 'com.apple.quicklook.ThumbnailsAgent'
# 'com.apple.quicklook'
# )
# Sidecar
AGENTS_TO_DISABLE+=(
'com.apple.sidecar-hid-relay'
'com.apple.sidecar-relay'
)
# Debugging process
AGENTS_TO_DISABLE+=(
'com.apple.spindump_agent'
'com.apple.ReportCrash'
'com.apple.ReportCrash.Root'
'com.apple.ReportGPURestart'
'com.apple.ReportPanic'
'com.apple.diagnostics_agent'
# 'com.apple.DiagnosticReportCleanup'
# 'com.apple.TrustEvaluationAgent'
)
# Screentime
AGENTS_TO_DISABLE+=(
'com.apple.ScreenTimeAgent'
'com.apple.UsageTrackingAgent'
)
# Parental controls
AGENTS_TO_DISABLE+=(
'com.apple.familycircled'
'com.apple.familycontrols.useragent'
'com.apple.familynotificationd'
'com.apple.parentalcontrols.check'
)
# Apple Music/Music.app
AGENTS_TO_DISABLE+=(
'com.apple.AMPDeviceDiscoveryAgent'
'com.apple.AMPDevicesAgent'
'com.apple.AMPLibraryAgent'
'com.apple.AMPArtworkAgent'
'com.apple.AOSHeartbeat'
'com.apple.AOSPushRelay'
)
# Others
AGENTS_TO_DISABLE+=(
# 'com.apple.telephonyutilities.callservicesd'
# 'com.apple.photoanalysisd'
'com.apple.AirPlayUIAgent'
'com.apple.AirPortBaseStationAgent'
'com.apple.SocialPushAgent'
# 'com.apple.findmymacmessenger'
# sharingd is used by the Finder to enable AirDrop file sharing, connecting to
# shared computers, and accessing Remote Discs from other computers.
# 'com.apple.sharingd'
# identityservicesd is a background process (Identity Services Daemon) that deals with
# third-party credentials.
# 'com.apple.identityservicesd'
# 'com.apple.java.InstallOnDemand'
# 'com.apple.parentalcontrols.check'
# 'com.apple.security.keychain-circle-notification'
# syncdefaultsd is the system daemon backing the NSUbiquitousKeyValueStore feature.
# 'com.apple.syncdefaultsd'
# 'com.apple.appleseed.seedusaged'
# 'com.apple.appleseed.seedusaged.postinstall'
# 'com.apple.CallHistorySyncHelper'
# 'com.apple.RemoteDesktop'
# 'com.apple.CallHistoryPluginHelper'
# 'com.apple.touristd'
'com.apple.macos.studentd'
# 'com.apple.KeyboardAccessAgent'
# 'com.apple.exchange.exchangesyncd'
# suggestd -- daemon that processes user content in order to detect contacts, events, named entities, etc.
# 'com.apple.suggestd'
# 'com.apple.AddressBook.abd'
# helpd is a macOS agent that manages software documentation.
# 'com.apple.helpd'
# mediasharingd is a per-user daemon which manages the user's media library sharing.
# 'com.apple.amp.mediasharingd'
# mediaanalysisd photos that's identifying faces and objects. It is CPU intensive process
# 'com.apple.mediaanalysisd'
# 'com.apple.mediaremoteagent'
'com.apple.remindd'
'com.apple.touristd' # Shows what's new but keeps lingering around talking back to apple
'com.apple.keyboardservicesd'
'com.apple.AddressBook.SourceSync'
'com.apple.telephonyutilities.callservicesd'
'com.apple.CalendarAgent'
)
# Phone Call Handoff
AGENTS_TO_DISABLE+=(
'com.apple.rapportd-user' # There's a daemon too
)
for agent in "${AGENTS_TO_DISABLE[@]}"; do
disable "$agent" Agent
done
# Daemons to disable
DAEMONS_TO_DISABLE=()
# iCloud
DAEMONS_TO_DISABLE+=(
# It's a data logging daemon. It collects your usage data and
# sends it to apple and/or app devs for analytics.
'com.apple.analyticsd'
)
# Game Center / Passbook / Apple TV / Homekit...
DAEMONS_TO_DISABLE+=(
'com.apple.GameController.gamecontrollerd'
)
# Others
DAEMONS_TO_DISABLE+=(
# 'com.apple.netbiosd'
# 'com.apple.preferences.timezone.admintool'
# 'com.apple.remotepairtool'
# 'com.apple.mobileassetd'
# Not in Catalina
# 'com.apple.SubmitDiagInfo'
# Full Disk Encryption Key Recovery Transmission Agent
# sends encrypted CoreStorage key recovery information to Apple. It is run
# only when "Store the recovery key with Apple" is selected, and even then only if the infor-
# mation could not be transmitted when that option was first selected.
# 'com.apple.security.FDERecoveryAgent'
# 'com.apple.screensharing'
# 'com.apple.appleseed.fbahelperd'
# apsd ApplePushService daemon for Apple Push Notification service. This is part of the
# ApplePushService framework.
# 'com.apple.apsd'
# Device Enollment
# 'com.apple.ManagedClient.cloudconfigurationd'
# 'com.apple.ManagedClient.enroll'
# 'com.apple.ManagedClient'
# 'com.apple.ManagedClient.startup'
# 'com.apple.locate'
# 'com.apple.locationd'
# eapolcfg_auth daemon used to configure EAP over LAN (EAPOL).
# allows an authorized process to perform privileged EAPOL configuration operations.
# 'com.apple.eapolcfg_auth'
# 'com.apple.RemoteDesktop.PrivilegeProxy'
# 'com.apple.mediaremoted'
)
# Phone Call Handoff
DAEMONS_TO_DISABLE+=(
'com.apple.rapportd' # There's an agent too
)
# Time Machine
DAEMONS_TO_DISABLE+=(
'com.apple.backupd-helper'
'com.apple.backupd'
)
for daemon in "${DAEMONS_TO_DISABLE[@]}"; do
disable "$daemon" Daemon
done
# vim: set et fdm=manual fenc=utf-8 ff=unix ft=sh ft=sh sts=0 sw=4 ts=4 tw=0 nowrap :
#!/bin/bash
#
# THESE SCRIPTS AND CHANGES ARE NOT MEANT FOR ANYBODY BUT ME.
# RUNNING THESE WILL MESS UP YOUR COMPUTER IN MYSTERIOUS AND USUALLY UNRECOVERABLE WAYS.
#
############################################################################################
# WARNING: THESE SCRIPTS AND CHANGES ARE NOT MEANT FOR ANYBODY BUT ME.
# RUNNING THESE WILL MESS UP YOUR COMPUTER IN MYSTERIOUS AND USUALLY UNRECOVERABLE WAYS.
############################################################################################
if [[ "$(sw_vers -productVersion)" != 10\.15* ]]; then
echo "This is only meant to run on macOS 10.15.* Catalina" >&2
exit 1
fi
LC_ALL=C
export LC_ALL
me="${0##*/}"
set -o errexit
set -o nounset
set -o pipefail
IFS=$'\n\t'
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
signed_out=false
if [[ -z "$(command -v mas)" && -n "$(command -v brew)" ]]; then
brew install mas
fi
if ! mas signout; then
echo "Could not sign out of the apple store automatically." >&2
else
signed_out=true
fi
if ! $signed_out; then
reply=
while [[ "$reply" != "OK" ]]; do
echo "Please sign out of apple store before proceeding. Type OK when ready or press Ctrl+c to abort."
read -r reply
done
fi
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
if ! csrutil status | grep -q ' disabled.$'; then
echo "System Integrity Protection is enabled. Can not proceed." >&2
exit 1
fi
sudo mount -uw /
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
full_dir="$(cd "$(dirname $BASH_SOURCE)" && pwd)"
cd "/Volumes/Macintosh HD"
if [[ "${1-}" != "execed" ]]; then
exec "/Volumes/Macintosh HD${full_dir}/${BASH_SOURCE##*/}" execed
fi
enable() {
local what kind
what="$1"
kind="$2"
cd "/Volumes/Macintosh HD"
# if [[ ! -e ./System/Library/Launch${kind}s/${what}.plist ]]; then
# if [[ -e ./System/Library/Launch${kind}s/${what}.plist.org ]]; then
# if sudo mv "./System/Library/Launch${kind}s/${what}.plist.org" "./System/Library/Launch${kind}s/${what}.plist"; then
# echo "SUCCESS: ${kind} ${what} enabled"
launchctl load -w "System/Library/Launch${kind}s/${what}.plist" || true
sudo launchctl load -w "System/Library/Launch${kind}s/${what}.plist" || true
return
# fi
# fi
# echo "FAILURE: ${kind} ${what} could not be enabled"
# fi
}
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
# Agents to enable
AGENTS_TO_ENABLE=()
# iCloud
AGENTS_TO_ENABLE+=(
'com.apple.security.cloudkeychainproxy3'
'com.apple.iCloudUserNotifications'
'com.apple.icloud.findmydeviced.findmydevice-user-agent'
'com.apple.icloud.fmfd'
'com.apple.icloud.searchpartyuseragent'
'com.apple.cloudd'
'com.apple.cloudpaird'
# cloudphotod is the iCloud Photos agent. It is responsible for all iCloud Photos activity.
'com.apple.cloudphotod'
'com.apple.followupd'
'com.apple.protectedcloudstorage.protectedcloudkeysyncing'
)
# Safari useless stuff
AGENTS_TO_ENABLE+=(
'com.apple.SafariBookmarksSyncAgent'
'com.apple.SafariCloudHistoryPushAgent'
'com.apple.WebKit.PluginAgent'
)
# iMessage / Facetime
AGENTS_TO_ENABLE+=(
'com.apple.imagent'
'com.apple.imautomatichistorydeletionagent'
'com.apple.imklaunchagent'
'com.apple.imtransferagent'
'com.apple.avconferenced'
)
# Game Center / Passbook / Apple TV / Homekit...
AGENTS_TO_ENABLE+=(
'com.apple.gamed'
'com.apple.passd'
'com.apple.Maps.pushdaemon'
'com.apple.videosubscriptionsd'
'com.apple.CommCenter-osx'
# homed is a daemon that manages home state and controls HomeKit accessories.
'com.apple.homed'
)
# Ad-related
AGENTS_TO_ENABLE+=(
'com.apple.ap.adprivacyd'
'com.apple.ap.adservicesd'
)
# Screensharing
AGENTS_TO_ENABLE+=(
'com.apple.screensharing.MessagesAgent'
'com.apple.screensharing.agent'
'com.apple.screensharing.menuextra'
)
# Siri
AGENTS_TO_ENABLE+=(
'com.apple.siriknowledged'
'com.apple.assistant_service'
'com.apple.assistantd'
'com.apple.siri-distributed-evaluation'
'com.apple.siri.context.service'
'com.apple.Siri.agent'
# parsecd is location-based suggestions for Siri.
'com.apple.parsecd'
'com.apple.parsec-fbf'
'com.apple.knowledge-agent'
)
# VoiceOver / accessibility-related stuff
AGENTS_TO_ENABLE+=(
'com.apple.VoiceOver'
'com.apple.voicememod'
'com.apple.accessibility.AXVisualSupportAgent'
'com.apple.accessibility.dfrhud'
'com.apple.accessibility.heard'
)
# Quicklook
AGENTS_TO_ENABLE+=(
'com.apple.quicklook.ui.helper'
'com.apple.quicklook.ThumbnailsAgent'
'com.apple.quicklook'
)
# Sidecar
AGENTS_TO_ENABLE+=(
'com.apple.sidecar-hid-relay'
'com.apple.sidecar-relay'
)
# Debugging process
AGENTS_TO_ENABLE+=(
'com.apple.spindump_agent'
'com.apple.ReportCrash'
'com.apple.ReportCrash.Root'
'com.apple.ReportGPURestart'
'com.apple.ReportPanic'
'com.apple.diagnostics_agent'
'com.apple.DiagnosticReportCleanup'
'com.apple.TrustEvaluationAgent'
)
# Screentime
AGENTS_TO_ENABLE+=(
'com.apple.ScreenTimeAgent'
'com.apple.UsageTrackingAgent'
)
# Parental controls
AGENTS_TO_ENABLE+=(
'com.apple.familycircled'
'com.apple.familycontrols.useragent'
'com.apple.familynotificationd'
'com.apple.parentalcontrols.check'
)
# Apple Music/Music.app
AGENTS_TO_ENABLE+=(
'com.apple.AMPDeviceDiscoveryAgent'
'com.apple.AMPDevicesAgent'
'com.apple.AMPLibraryAgent'
'com.apple.AMPArtworkAgent'
'com.apple.AOSHeartbeat'
'com.apple.AOSPushRelay'
)
# Others
AGENTS_TO_ENABLE+=(
'com.apple.telephonyutilities.callservicesd'
'com.apple.photoanalysisd'
'com.apple.AirPlayUIAgent'
'com.apple.AirPortBaseStationAgent'
'com.apple.SocialPushAgent'
'com.apple.findmymacmessenger'
# sharingd is used by the Finder to enable AirDrop file sharing, connecting to
# shared computers, and accessing Remote Discs from other computers.
'com.apple.sharingd'
# identityservicesd is a background process (Identity Services Daemon) that deals with
# third-party credentials.
'com.apple.identityservicesd'
'com.apple.java.InstallOnDemand'
'com.apple.parentalcontrols.check'
'com.apple.security.keychain-circle-notification'
# syncdefaultsd is the system daemon backing the NSUbiquitousKeyValueStore feature.
'com.apple.syncdefaultsd'
'com.apple.appleseed.seedusaged'
'com.apple.appleseed.seedusaged.postinstall'
'com.apple.CallHistorySyncHelper'
'com.apple.RemoteDesktop'
'com.apple.CallHistoryPluginHelper'
'com.apple.touristd'
'com.apple.macos.studentd'
'com.apple.KeyboardAccessAgent'
'com.apple.exchange.exchangesyncd'
# suggestd -- daemon that processes user content in order to detect contacts, events, named entities, etc.
'com.apple.suggestd'
'com.apple.AddressBook.abd'
# helpd is a macOS agent that manages software documentation.
'com.apple.helpd'
# mediasharingd is a per-user daemon which manages the user's media library sharing.
'com.apple.amp.mediasharingd'
# mediaanalysisd photos that's identifying faces and objects. It is CPU intensive process
'com.apple.mediaanalysisd'
'com.apple.mediaremoteagent'
'com.apple.remindd'
'com.apple.touristd' # Shows what's new but keeps lingering around talking back to apple
'com.apple.keyboardservicesd'
'com.apple.AddressBook.SourceSync'
'com.apple.telephonyutilities.callservicesd'
'com.apple.CalendarAgent'
)
# Phone Call Handoff
AGENTS_TO_ENABLE+=(
'com.apple.rapportd-user' # There's a daemon too
)
for agent in "${AGENTS_TO_ENABLE[@]}"; do
enable "${agent}" Agent
done
# Daemons to enable
DAEMONS_TO_ENABLE=()
# iCloud
DAEMONS_TO_ENABLE+=(
# It's a data logging daemon. It collects your usage data and
# sends it to apple and/or app devs for analytics.
'com.apple.analyticsd'
)
# Game Center / Passbook / Apple TV / Homekit...
DAEMONS_TO_ENABLE+=(
'com.apple.GameController.gamecontrollerd'
)
# Others
DAEMONS_TO_ENABLE+=(
'com.apple.netbiosd'
'com.apple.preferences.timezone.admintool'
'com.apple.remotepairtool'
'com.apple.mobileassetd'
# Not in Catalina
# 'com.apple.SubmitDiagInfo'
# Full Disk Encryption Key Recovery Transmission Agent
# sends encrypted CoreStorage key recovery information to Apple. It is run
# only when "Store the recovery key with Apple" is selected, and even then only if the infor-
# mation could not be transmitted when that option was first selected.
'com.apple.security.FDERecoveryAgent'
'com.apple.screensharing'
'com.apple.appleseed.fbahelperd'
# apsd ApplePushService daemon for Apple Push Notification service. This is part of the
# ApplePushService framework.
'com.apple.apsd'
# Device Enollment
'com.apple.ManagedClient.cloudconfigurationd'
'com.apple.ManagedClient.enroll'
'com.apple.ManagedClient'
'com.apple.ManagedClient.startup'
'com.apple.locate'
'com.apple.locationd'
# eapolcfg_auth daemon used to configure EAP over LAN (EAPOL).
# allows an authorized process to perform privileged EAPOL configuration operations.
'com.apple.eapolcfg_auth'
'com.apple.RemoteDesktop.PrivilegeProxy'
'com.apple.mediaremoted'
)
# Phone Call Handoff
DAEMONS_TO_ENABLE+=(
'com.apple.rapportd'
)
# Time Machine
DAEMONS_TO_ENABLE+=(
'com.apple.backupd-helper'
'com.apple.backupd'
)
for daemon in "${DAEMONS_TO_ENABLE[@]}"; do
enable "${daemon}" Daemon
done
# vim: set et fdm=manual fenc=utf-8 ff=unix ft=sh ft=sh sts=0 sw=4 ts=4 tw=0 nowrap :
@junkblocker
Copy link
Author

I am not using this script anymore as this whole thing is fraught with system unstability.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment