Last active
May 29, 2024 05:58
-
-
Save lcenchew/a0d5cef2f59d978c2c36c86f78205e0f to your computer and use it in GitHub Desktop.
new macOS setup automation #snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# brew bundle | |
# shell | |
# development | |
brew "git" | |
cask "sourcetree" | |
cask "visual-studio-code" | |
cask "android-studio" | |
cask "iterm2" | |
cask "docker" | |
cask "dbeaver-community" | |
brew "awscli" | |
brew "aws-cdk" | |
cask "google-cloud-sdk" | |
brew "python" | |
# management & tools | |
brew "mas" | |
brew "wget" | |
brew "rsync" | |
brew "nmap" | |
cask "chrome-remote-desktop-host" | |
cask "dupeguru" | |
cask "tomighty" | |
# disk tools | |
cask "macfuse" | |
cask "cryptomator" | |
cask "veracrypt" | |
# backup | |
cask "google-drive" | |
cask "onedrive" | |
cask "sync" | |
# security | |
cask "keepassxc" | |
cask "openvpn-connect" | |
# browsers | |
cask "firefox" | |
cask "google-chrome" | |
cask "brave-browser" | |
# applications | |
cask "calibre" | |
cask "vlc" | |
cask "microsoft-word" | |
cask "microsoft-excel" | |
cask "microsoft-powerpoint" | |
# appstore applications | |
mas "Xcode", id: 497799835 | |
mas "Microsoft OneNote", id: 784801555 | |
mas "Microsoft Remote Desktop", id: 1295203466 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it! | |
# 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. | |
# 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 | |
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE 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 | |
TODISABLE=() | |
# iCloud | |
TODISABLE+=('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' \ | |
'com.apple.cloudphotosd' \ | |
'com.apple.followupd' \ | |
'com.apple.protectedcloudstorage.protectedcloudkeysyncing') | |
# Safari useless stuff | |
TODISABLE+=('com.apple.SafariBookmarksSyncAgent' \ | |
'com.apple.SafariCloudHistoryPushAgent' \ | |
'com.apple.WebKit.PluginAgent') | |
# iMessage / Facetime | |
TODISABLE+=('com.apple.imagent' \ | |
'com.apple.imautomatichistorydeletionagent' \ | |
'com.apple.imklaunchagent' \ | |
'com.apple.imtransferagent' \ | |
'com.apple.avconferenced') | |
# Game Center / Passbook / Apple TV / Homekit... | |
TODISABLE+=('com.apple.gamed' \ | |
'com.apple.passd' \ | |
'com.apple.Maps.pushdaemon' \ | |
'com.apple.videosubscriptionsd' \ | |
'com.apple.CommCenter-osx' \ | |
'com.apple.homed') | |
# Ad-related | |
TODISABLE+=('com.apple.ap.adprivacyd' \ | |
'com.apple.ap.adservicesd') | |
# Screensharing | |
TODISABLE+=('com.apple.screensharing.MessagesAgent' \ | |
'com.apple.screensharing.agent' \ | |
'com.apple.screensharing.menuextra') | |
# Siri | |
TODISABLE+=('com.apple.siriknowledged' \ | |
'com.apple.assistant_service' \ | |
'com.apple.assistantd' \ | |
'com.apple.Siri.agent' \ | |
'com.apple.parsec-fbf') | |
# VoiceOver / accessibility-related stuff | |
TODISABLE+=('com.apple.VoiceOver' \ | |
'com.apple.voicememod' \ | |
'com.apple.accessibility.AXVisualSupportAgent' \ | |
'com.apple.accessibility.dfrhud' \ | |
'com.apple.accessibility.heard') | |
# Quicklook | |
TODISABLE+=('com.apple.quicklook.ui.helper' \ | |
'com.apple.quicklook.ThumbnailsAgent' \ | |
'com.apple.quicklook') | |
# Sidecar | |
TODISABLE+=('com.apple.sidecar-hid-relay' \ | |
'com.apple.sidecar-relay') | |
# Debugging process | |
TODISABLE+=('com.apple.spindump_agent' \ | |
'com.apple.ReportCrash' \ | |
'com.apple.ReportGPURestart' \ | |
'com.apple.ReportPanic' \ | |
'com.apple.DiagnosticReportCleanup' \ | |
'com.apple.TrustEvaluationAgent') | |
# Screentime | |
TODISABLE+=('com.apple.ScreenTimeAgent' \ | |
'com.apple.UsageTrackingAgent') | |
# Others | |
TODISABLE+=('com.apple.telephonyutilities.callservicesd' \ | |
'com.apple.photoanalysisd' \ | |
'com.apple.parsecd' \ | |
'com.apple.AOSPushRelay' \ | |
'com.apple.AOSHeartbeat' \ | |
'com.apple.AirPlayUIAgent' \ | |
'com.apple.AirPortBaseStationAgent' \ | |
'com.apple.familycircled' \ | |
'com.apple.familycontrols.useragent' \ | |
'com.apple.familynotificationd' \ | |
'com.apple.findmymacmessenger' \ | |
'com.apple.sharingd' \ | |
'com.apple.identityservicesd' \ | |
'com.apple.java.InstallOnDemand' \ | |
'com.apple.parentalcontrols.check' \ | |
'com.apple.security.keychain-circle-notification' \ | |
'com.apple.syncdefaultsd' \ | |
'com.apple.appleseed.seedusaged' \ | |
'com.apple.appleseed.seedusaged.postinstall' \ | |
'com.apple.CallHistorySyncHelper' \ | |
'com.apple.RemoteDesktop' \ | |
'com.apple.CallHistoryPluginHelper' \ | |
'com.apple.SocialPushAgent' \ | |
'com.apple.touristd' \ | |
'com.apple.macos.studentd' \ | |
'com.apple.KeyboardAccessAgent' \ | |
'com.apple.exchange.exchangesyncd' \ | |
'com.apple.suggestd' \ | |
'com.apple.AddressBook.abd' \ | |
'com.apple.helpd' \ | |
'com.apple.amp.mediasharingd' \ | |
'com.apple.mediaanalysisd' \ | |
'com.apple.mediaremoteagent' \ | |
'com.apple.remindd' \ | |
'com.apple.keyboardservicesd' \ | |
'com.apple.AddressBook.SourceSync' \ | |
'com.apple.telephonyutilities.callservicesd' \ | |
'com.apple.mobileassetd' \ | |
'com.apple.CalendarAgent' \ | |
'com.apple.knowledge-agent') | |
for agent in "${TODISABLE[@]}" | |
do | |
mv ./System/Library/LaunchAgents/${agent}.plist ./System/Library/LaunchAgents/${agent}.plist.bak | |
echo "[OK] Agent ${agent} disabled" | |
done | |
# Daemons to disable | |
TODISABLE=() | |
# iCloud | |
TODISABLE+=('com.apple.analyticsd', 'com.apple.icloud.findmydeviced') | |
# Others | |
TODISABLE+=('com.apple.netbiosd' \ | |
'com.apple.preferences.timezone.admintool' \ | |
'com.apple.remotepairtool' \ | |
'com.apple.security.FDERecoveryAgent' \ | |
'com.apple.SubmitDiagInfo' \ | |
'com.apple.screensharing' \ | |
'com.apple.appleseed.fbahelperd' \ | |
'com.apple.apsd' \ | |
'com.apple.ManagedClient.cloudconfigurationd' \ | |
'com.apple.ManagedClient.enroll' \ | |
'com.apple.ManagedClient' \ | |
'com.apple.ManagedClient.startup' \ | |
'com.apple.locate' \ | |
'com.apple.locationd' \ | |
'com.apple.eapolcfg_auth' \ | |
'com.apple.RemoteDesktop.PrivilegeProxy' \ | |
'com.apple.mediaremoted') | |
for daemon in "${TODISABLE[@]}" | |
do | |
mv ./System/Library/LaunchDaemons/${daemon}.plist ./System/Library/LaunchDaemons/${daemon}.plist.bak | |
echo "[OK] Daemon ${daemon} disabled" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# set your own default settings | |
sudo -v | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
# Add a Brewfile first | |
brew bundle | |
brew tap AdoptOpenJDK/openjdk | |
brew cask install adoptopenjdk11 | |
# config for zsh | |
chmod go-w '/usr/local/share' | |
chmod -R go-w '/usr/local/share/zsh' | |
## Customise the Dock | |
# System Preferences > Dock > Size: | |
defaults write com.apple.dock tilesize -int 30 | |
# System Preferences > Dock > Magnification: | |
defaults write com.apple.dock magnification -bool true | |
# System Preferences > Dock > Size (magnified): | |
defaults write com.apple.dock largesize -int 120 | |
# System Preferences > Dock > Minimize windows using: Scale effect | |
defaults write com.apple.dock mineffect -string "suck" | |
# System Preferences > Dock > Minimize windows into application icon | |
defaults write com.apple.dock minimize-to-application -bool true | |
# System Preferences > Dock > Automatically hide and show the Dock: | |
defaults write com.apple.dock autohide -bool true | |
# System Preferences > Dock > Automatically hide and show the Dock (duration) | |
defaults write com.apple.dock autohide-time-modifier -float 0.5 | |
# System Preferences > Dock > Automatically hide and show the Dock (delay) | |
defaults write com.apple.dock autohide-delay -float 0 | |
# System Preferences > Dock > Show indicators for open applications | |
defaults write com.apple.dock show-process-indicators -bool true | |
# Clean up the Dock | |
brew install dockutil | |
dockutil --remove Messages | |
dockutil --remove Mail | |
dockutil --remove Maps | |
dockutil --remove Photos | |
dockutil --remove FaceTime | |
dockutil --remove Calendar | |
dockutil --remove Contacts | |
dockutil --remove Reminders | |
dockutil --remove Notes | |
dockutil --remove Freeform | |
dockutil --remove TV | |
dockutil --remove Music | |
dockutil --remove "App Store" | |
dockutil --remove Podcasts | |
dockutil --remove iTunes | |
dockutil --remove Siri | |
dockutil --remove News | |
dockutil --remove Keynote | |
dockutil --remove Pages | |
dockutil --remove Facetime | |
dockutil --remove AppStore | |
# High Serria | |
dockutil --add '/Applications/Mission Control.app' --position 1 | |
# Catalina | |
dockutil --add '/System/Applications/Mission Control.app' --position 1 | |
dockutil --add '/Applications/Visual Studio Code.app/' --position 5 | |
dockutil --add '/Applications/iTerm.app/' --position 5 | |
dockutil --add '/Applications/Brave Browser.app/' --position 5 | |
dockutil --add '/Applications/Firefox.app/' --position 3 | |
dockutil --add '/Applications/Google Chrome.app/' --position 5 | |
brew uninstall dockutil | |
# set some application defaults | |
# Save screenshots to the desktop | |
mkdir "$HOME/Desktop/screenshot" | |
defaults write com.apple.screencapture location -string "$HOME/Desktop/screenshot" | |
# trackpad & mouse | |
# tap to click | |
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true | |
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true | |
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
# Setting trackpad & mouse speed to a reasonable number | |
defaults write -g com.apple.trackpad.scaling 2 | |
defaults write -g com.apple.mouse.scaling 2.5 | |
# defaults write com.apple.trackpad.forceClick -bool false | |
# Don’t automatically rearrange Spaces based on most recent use | |
defaults write com.apple.dock mru-spaces -bool false | |
# Top right screen corner → Disable screen saver | |
defaults write com.apple.dock wvous-t1-corner -int 6 | |
defaults write com.apple.dock wvous-tr-modifier -int 0 | |
# Bottom left screen corner → Start screen saver | |
defaults write com.apple.dock wvous-bl-corner -int 5 | |
defaults write com.apple.dock wvous-bl-modifier -int 0 | |
# Turn off keyboard illumination when computer is not used for 5 minutes | |
defaults write com.apple.BezelServices kDimTime -int 300 | |
## Finder | |
# Display full POSIX path as Finder window title | |
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true | |
# Use column view in all Finder windows by default | |
defaults write com.apple.finder FXPreferredViewStyle Clmv | |
# Finder: show status bar | |
defaults write com.apple.finder ShowStatusBar -bool true | |
# Avoid creation of .DS_Store files on network/USB volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true | |
# Prevent Time Machine from prompting to use new hard drives as backup volume | |
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true | |
# Show language menu in the top right corner of the boot screen | |
sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true | |
# Show the ~/Library folder | |
chflags nohidden ~/Library | |
# Only use UTF-8 in Terminal.app | |
defaults write com.apple.terminal StringEncodings -array 4 | |
# Open and save files as UTF-8 in TextEdit | |
defaults write com.apple.TextEdit PlainTextEncoding -int 4 | |
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 | |
# Use plain text mode for new TextEdit documents | |
defaults write com.apple.TextEdit RichText -int 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment