|
| 1 | +#!/usr/bin/zsh |
| 2 | + |
| 3 | +OS_USER=`whoami` |
| 4 | + |
| 5 | +# default input methods |
| 6 | +read -r -d '' DEFAULT_INPUT_METHODS << EOF |
| 7 | +[{ |
| 8 | + "InputSourceKind": "Keyboard Layout", |
| 9 | + "KeyboardLayout ID": "252", |
| 10 | + "KeyboardLayout Name": "ABC" |
| 11 | +}, |
| 12 | +{ |
| 13 | + "Bundle ID": "com.apple.inputmethod.SCIM", |
| 14 | + "Input Mode": "com.apple.inputmethod.SCIM.ITABC", |
| 15 | + "InputSourceKind": "Input Mode" |
| 16 | +}, |
| 17 | +{ |
| 18 | + "Bundle ID": "com.apple.CharacterPaletteIM", |
| 19 | + "InputSourceKind": "Non Keyboard Input Method" |
| 20 | +}, |
| 21 | +{ |
| 22 | + "Bundle ID": "com.apple.inputmethod.EmojiFunctionRowItem", |
| 23 | + "InputSourceKind": "Non Keyboard Input Method" |
| 24 | +}, |
| 25 | +{ |
| 26 | + "Bundle ID": "im.rime.inputmethod.Squirrel", |
| 27 | + "Input Mode": "im.rime.inputmethod.Squirrel", |
| 28 | + "InputSourceKind": "Input Mode" |
| 29 | +}, |
| 30 | +{ |
| 31 | + "Bundle ID": "im.rime.inputmethod.Squirrel", |
| 32 | + "InputSourceKind": "Keyboard Input Method" |
| 33 | +}] |
| 34 | +EOF |
| 35 | + |
| 36 | +set -xe |
| 37 | + |
| 38 | +# disable Gatekeeper |
| 39 | +sudo spctl --master-disable |
| 40 | + |
| 41 | +# set display sleep timer |
| 42 | +sudo pmset -a displaysleep 60 |
| 43 | +sudo pmset -b displaysleep 15 |
| 44 | + |
| 45 | +# automatically hide menu bar |
| 46 | +defaults write NSGlobalDomain _HIHideMenuBar -bool YES |
| 47 | + |
| 48 | +# fastest key repeat & shortest delay until repeat |
| 49 | +defaults write NSGlobalDomain InitialKeyRepeat -int 35 |
| 50 | +defaults write NSGlobalDomain KeyRepeat -int 12 |
| 51 | + |
| 52 | +# Dock magnification |
| 53 | +# defaults write com.apple.dock magnification -bool YES |
| 54 | +# Dock tile size |
| 55 | +# defaults write com.apple.dock tilesize -int 16 |
| 56 | + |
| 57 | +# Prevent Time Machine from Prompting to Use New Hard Drives as Backup Volume |
| 58 | +sudo defaults write /Library/Preferences/com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool YES |
| 59 | + |
| 60 | +# Add a spcace to Dock |
| 61 | +# defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}' |
| 62 | + |
| 63 | +# Lock Dock size |
| 64 | +defaults write com.apple.Dock size-immutable -bool YES |
| 65 | + |
| 66 | +# Disable Dock bouncing to get attention |
| 67 | +# defaults write com.apple.Dock no-bouncing -bool YES |
| 68 | + |
| 69 | +# disable disk image verification |
| 70 | +defaults write com.apple.frameworks.diskimages skip-verify -bool YES |
| 71 | +defaults write com.apple.frameworks.diskimages skip-verify-locked -bool YES |
| 72 | +defaults write com.apple.frameworks.diskimages skip-verify-remote -bool YES |
| 73 | + |
| 74 | +# Expand Save Panel by Default |
| 75 | +defaults write -g NSNavPanelExpandedStateForSaveMode -bool YES |
| 76 | +defaults write -g NSNavPanelExpandedStateForSaveMode2 -bool YES |
| 77 | + |
| 78 | +# Save to Disk by Default |
| 79 | +defaults write -g NSDocumentSaveNewDocumentsToCloud -bool NO |
| 80 | + |
| 81 | +# Finder prefereneces |
| 82 | +defaults write com.apple.finder ShowPathbar -bool YES |
| 83 | +defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" |
| 84 | +defaults write com.apple.finder FXEnableExtensionChangeWarning -bool NO |
| 85 | +defaults write com.apple.finder FXEnableRemoveFromICloudDriveWarning -bool YES |
| 86 | +defaults write com.apple.finder NewWindowTarget PfHm |
| 87 | +defaults write com.apple.finder NewWindowTargetPath "file:///Users/$OS_USER/" |
| 88 | +defaults write com.apple.finder PreferencesWindow.LastSelection "ADVD" |
| 89 | +defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool NO |
| 90 | +defaults write com.apple.finder ShowRecentTags -bool NO |
| 91 | +defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool NO |
| 92 | +defaults write com.apple.finder _FXSortFoldersFirst -bool YES |
| 93 | +defaults write com.apple.finder _FXSortFoldersFirstOnDesktop -bool YES |
| 94 | + |
| 95 | +# Disable Creation of Metadata Files on Network Volumes |
| 96 | +defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool YES |
| 97 | + |
| 98 | +# Disable Creation of Metadata Files on USB Volumes |
| 99 | +defaults write com.apple.desktopservices DSDontWriteUSBStores -bool YES |
| 100 | + |
| 101 | +# hide icons in menu bar |
| 102 | +defaults write com.apple.Spotlight 'NSStatusItem Visible Item-0' -bool NO |
| 103 | +defaults write com.apple.airplay 'NSStatusItem Visible Item-0' -bool NO |
| 104 | +defaults write com.apple.controlcenter 'NSStatusItem Visible Battery' -bool NO |
| 105 | +defaults write com.apple.Siri "StatusMenuVisible" -bool NO |
| 106 | + |
| 107 | +# block ocsp.apple.com |
| 108 | +# sudo echo "0.0.0.0 ocsp.apple.com" >> /etc/hosts |
| 109 | + |
| 110 | +# set default input methods |
| 111 | +sudo plutil -replace AppleEnabledInputSources -json $DEFAULT_INPUT_METHODS /Library/Preferences/com.apple.HIToolbox.plist |
0 commit comments