Created
September 21, 2020 01:03
-
-
Save CaledoniaProject/976ce87792e9c1600b7b1ce235da5752 to your computer and use it in GitHub Desktop.
Setup mac and default settings, sudo privilege required
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 | |
echo Setting up ComputerName and HostName | |
sudo scutil --set ComputerName XXX | |
sudo scutil --set HostName XXX | |
echo Disable spotlight | |
sudo mdutil -a -i off | |
echo Disable guest account | |
sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO | |
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO | |
echo Disable Bluetooth | |
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0 | |
sudo killall -HUP blued | |
echo Disable Push Notification | |
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.apsd.plist | |
echo Disable rapportd | |
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.rapportd.plist | |
#echo Disable mDNSResponder | |
#sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.mDNSResponder.plist | |
echo Disable Captive portal | |
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false | |
echo Disable boujour | |
sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool YES | |
echo Setup Firewall | |
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on --setstealthmode on --setallowsignedapp off | |
# echo Disable gamed | |
# launchctl unload /System/Library/LaunchAgents/com.apple.gamed.plist | |
echo Disable dylib support in Microsoft Office | |
defaults write com.microsoft.office AllowVisualBasicToBindToSystem -bool no | |
defaults write com.microsoft.office DisableVisualBasicExternalDylibs -bool yes | |
echo Setup Screen Capture | |
defaults write com.apple.screencapture location /run/shm/ | |
defaults write com.apple.screencapture name screenshot | |
defaults write com.apple.screencapture type jpg | |
defaults write com.apple.screencapture show-thumbnail -bool FALSE | |
echo AD Tracking | |
defaults write ~/Library/Preferences/ByHost/com.apple.preference.security.privacy limitAdTrackingCached -int 0 | |
defaults write com.apple.AdLib forceLimitAdTracking -int 1 | |
defaults write com.apple.AdLib "AD_DEVICE_IDFA" -string "00000000-0000-0000-0000-000000000000" | |
echo Set ScreenSaver timeout | |
defaults -currentHost write com.apple.screensaver idleTime -int 120 | |
defaults write com.apple.screensaver askForPasswordDelay -int 0 | |
defaults write com.apple.screensaver askForPassword -int 1 | |
echo Setup Finder | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
#defaults write com.apple.finder ShowPathbar -bool true | |
defaults write com.apple.finder ShowStatusBar -bool true | |
echo Default not save to cloud | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
echo Disable crash report | |
defaults write com.apple.CrashReporter DialogType none | |
echo Disable DS_Store on network devices | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
echo Setup Input and TouchPad | |
defaults write NSGlobalDomain com.apple.keyboard.fnState -int 1 | |
# 反向滑动 | |
#defaults write NSGlobalDomain com.apple.swipescrolldirection -int 0 | |
# 触碰当做点击 | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true | |
# 三个手指移动 | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -int 0 | |
echo Setup Finder | |
defaults write com.apple.finder WarnOnEmptyTrash 0 | |
defaults write com.apple.finder FXEnableExtensionChangeWarning 0 | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
echo Disable spell autocorrect | |
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false | |
echo Setup Safari | |
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false | |
echo Setup Dock | |
defaults write com.apple.dock orientation left | |
defaults write com.apple.dock tilesize 32 | |
defaults write com.apple.dock magnification 0 | |
defaults write com.apple.dock launchanim -bool false | |
echo Disable Window Animations | |
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false | |
defaults write -g NSWindowResizeTime -float 0.1 | |
defaults write -g NSScrollAnimationEnabled -bool false | |
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false | |
echo Setup Launchpad | |
defaults write com.apple.dock springboard-hide-duration -int 0 | |
defaults write com.apple.dock springboard-show-duration -int 0 | |
defaults write com.apple.dock springboard-page-duration -float 0 | |
echo Setup Mission Control | |
defaults write com.apple.dock expose-animation-duration -float 0.1 | |
echo Setup Mail | |
defaults write com.apple.Mail DisableReplyAnimations -bool YES | |
defaults write com.apple.Mail DisableSendAnimations -bool YES | |
echo Setup TimeMachine | |
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true | |
echo Setup Printer | |
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true | |
echo Setup Panel | |
defaults write com.apple.menuextra.clock DateFormat "EEE HH:mm" | |
echo Restarting SystemUIServer and Dock | |
killall SystemUIServer Dock |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment