defaults-set.zsh 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. # Pre-setup
  2. echo "Configuring your mac, password will be necessary"
  3. # Close any open System Preferences panes, to prevent them from overriding settings we’re about to change
  4. osascript -e 'tell application "System Preferences" to quit'
  5. # Ask for the administrator password upfront
  6. sudo -v
  7. # Keep-alive: update existing `sudo` time stamp until `.macos` has finished
  8. while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
  9. function defaultsset {
  10. # Aliases
  11. alias firewall='/usr/libexec/ApplicationFirewall/socketfilterfw'
  12. alias firewalltoggle='firewall --setglobalstate off && firewall --setglobalstate on'
  13. alias flushdns='sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder; echo "DNS cache flushed"'
  14. alias fixopenwith='/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user'
  15. alias dropboxfinderreset='pluginkit -e use -i com.getdropbox.dropbox.garcon'
  16. alias fixApp="xattr -cr /Applications/$1.app" # MacOS sometimes pretends apps made by developers that don't pay them a fee are 'corrupted'. This is not true and the apps can be easily run.
  17. # Compatibility aliases
  18. alias top="btop"
  19. #alias top="htop"
  20. # Other
  21. sudo /usr/libexec/configureLocalKDC
  22. # Functions
  23. function restart {
  24. if [[ "$(fdesetup isactive)" = "true" ]]; then
  25. # FileVault authenticated restart
  26. sudo fdesetup authrestart -verbose
  27. else
  28. # Normal restart
  29. sudo shutdown -r now "Rebooting now"
  30. fi
  31. }
  32. function sysinfo {
  33. uname -a
  34. sw_vers -productVersion
  35. system_profiler SPSoftwareDataType
  36. }
  37. # Defaults
  38. defaults write -g InitialKeyRepeat -int 15 # normal minimum is 15 (225 ms)
  39. defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms)
  40. # Disable the sound effects on boot
  41. sudo nvram SystemAudioVolume=" "
  42. # Disable transparency which improves performance but looks worse
  43. #defaults write com.apple.universalaccess reduceTransparency -bool true
  44. # Set purple accent color that looks way better than the default MacOS purple
  45. defaults write NSGlobalDomain AppleHighlightColor -string "0.435294 0.427450 1.000000"
  46. # Set sidebar icon size to small
  47. defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1
  48. # Auto-show scrollbar
  49. defaults write NSGlobalDomain AppleShowScrollBars -string "Automatic"
  50. # Disable the over-the-top focus ring animation
  51. defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false
  52. # Increase window resize speed for Cocoa applications
  53. defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
  54. # Expand save panel by default
  55. defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
  56. defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
  57. # Expand print panel by default
  58. defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
  59. defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
  60. # Save to disk (not to iCloud) by default
  61. defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
  62. # Disable the “Are you sure you want to open this application?” dialog
  63. defaults write com.apple.LaunchServices LSQuarantine -bool false
  64. # Remove duplicates in the “Open With” menu
  65. /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
  66. # Disable the crash reporter
  67. defaults write com.apple.CrashReporter DialogType -string "none"
  68. # Set Help Viewer windows to non-floating mode
  69. defaults write com.apple.helpviewer DevMode -bool true
  70. # Reveal IP address, hostname, OS version, etc. when clicking the clock in the login window
  71. sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
  72. # Show language menu in the top right corner of the boot screen
  73. sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true
  74. # Trackpad: enable tap to click for this user and for the login screen
  75. defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
  76. defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
  77. defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
  78. # Increase sound quality for Bluetooth headphones/headsets
  79. defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
  80. # Use scroll gesture with the Ctrl (^) modifier key to zoom
  81. defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
  82. defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
  83. # Stop Apple Music from responding to the keyboard media keys
  84. launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null
  85. # Enable lid wakeup
  86. sudo pmset -a lidwake 1
  87. # Sleep the display after 15 minutes
  88. sudo pmset -a displaysleep 15
  89. # Disable machine sleep while charging
  90. sudo pmset -c sleep 0
  91. # Set machine sleep to 20 minutes on battery
  92. sudo pmset -b sleep 20
  93. # Hibernation mode
  94. # 0: Disable hibernation (speeds up entering sleep mode)
  95. # 3: Copy RAM to disk so the system state can still be restored in case of power failure.
  96. sudo pmset -a hibernatemode 3
  97. # Remove the sleep image file to save disk space
  98. #sudo rm /private/var/vm/sleepimage
  99. # Create a zero-byte file instead…
  100. #sudo touch /private/var/vm/sleepimage
  101. # …and make sure it can’t be rewritten
  102. #sudo chflags uchg /private/var/vm/sleepimage
  103. # Require password after sleep or screen saver begins
  104. defaults write com.apple.screensaver askForPassword -int 1
  105. # Save screenshots to Pictures
  106. defaults write com.apple.screencapture location -string "${HOME}/Pictures"
  107. # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
  108. defaults write com.apple.screencapture type -string "png"
  109. # Disable shadow in screenshots
  110. defaults write com.apple.screencapture disable-shadow -bool true
  111. # Enable subpixel font rendering on non-Apple LCDs
  112. # Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501
  113. defaults write NSGlobalDomain AppleFontSmoothing -int 1
  114. # Enable HiDPI display modes (requires restart)
  115. sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
  116. # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
  117. defaults write com.apple.finder QuitMenuItem -bool true
  118. # Finder: disable window animations and Get Info animations
  119. defaults write com.apple.finder DisableAllAnimations -bool true
  120. # Set your home folder as the default location for new Finder windows
  121. defaults write com.apple.finder NewWindowTarget -string "PfLo"
  122. defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
  123. # Finder: show hidden files by default
  124. defaults write com.apple.finder AppleShowAllFiles -bool true
  125. # Finder: show all filename extensions
  126. defaults write NSGlobalDomain AppleShowAllExtensions -bool true
  127. # Finder: hide status bar
  128. defaults write com.apple.finder ShowStatusBar -bool false
  129. # Finder: show path bar
  130. defaults write com.apple.finder ShowPathbar -bool true
  131. # Display full POSIX path as Finder window title
  132. #defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
  133. # Keep folders on top when sorting by name
  134. defaults write com.apple.finder _FXSortFoldersFirst -bool true
  135. # When performing a search, search the current folder by default
  136. defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
  137. # Disable the warning when changing a file extension
  138. defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
  139. # Enable spring loading for directories
  140. defaults write NSGlobalDomain com.apple.springing.enabled -bool true
  141. # Avoid creating .DS_Store files on network or USB volumes
  142. defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
  143. defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
  144. # Enable snap-to-grid for icons on the desktop and in other icon views
  145. /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
  146. /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
  147. /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
  148. # Use list view in all Finder windows by default
  149. # Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv`
  150. defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
  151. # Disable the warning before emptying the Trash
  152. defaults write com.apple.finder WarnOnEmptyTrash -bool false
  153. # Enable AirDrop over Ethernet
  154. defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
  155. # Show the ~/Library folder
  156. chflags nohidden ~/Library && xattr -d com.apple.FinderInfo ~/Library
  157. # Show the /Volumes folder
  158. sudo chflags nohidden /Volumes
  159. # Show the .config folder
  160. sudo chflags nohidden "${HOME}/.config"
  161. # Remove Dropbox’s green checkmark icons in Finder
  162. file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns
  163. [ -e "${file}" ] && mv -f "${file}" "${file}.bak"
  164. # Expand the following File Info panes:
  165. # “General”, “Open with”, and “Sharing & Permissions”
  166. defaults write com.apple.finder FXInfoPanesExpanded -dict \
  167. General -bool true \
  168. OpenWith -bool true \
  169. Privileges -bool true
  170. # Enable highlight hover effect for the grid view of a stack (Dock)
  171. defaults write com.apple.dock mouse-over-hilite-stack -bool true
  172. # Set the icon size of Dock items to 36 pixels
  173. defaults write com.apple.dock tilesize -int 36
  174. # Change minimize/maximize window effect
  175. defaults write com.apple.dock mineffect -string "scale"
  176. # Minimize windows into their application’s icon
  177. defaults write com.apple.dock minimize-to-application -bool true
  178. # Enable spring loading for all Dock items
  179. defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
  180. # Show indicator lights for open applications in the Dock
  181. defaults write com.apple.dock show-process-indicators -bool true
  182. # Wipe all (default) app icons from the Dock
  183. #defaults write com.apple.dock persistent-apps -array
  184. # Don’t animate opening applications from the Dock
  185. defaults write com.apple.dock launchanim -bool false
  186. # Speed up Mission Control animations
  187. defaults write com.apple.dock expose-animation-duration -float 0.1
  188. # Group windows by application in Mission Control
  189. defaults write com.apple.dock expose-group-by-app -bool true
  190. # Don’t automatically rearrange Spaces based on most recent use
  191. defaults write com.apple.dock mru-spaces -bool false
  192. # Shorten the auto-hiding Dock delay
  193. defaults write com.apple.dock autohide-delay -float 0.1
  194. # Remove the animation when hiding/showing the Dock
  195. defaults write com.apple.dock autohide-time-modifier -float 0
  196. # Don't automatically hide and show the Dock
  197. defaults write com.apple.dock autohide -bool false
  198. # Make Dock icons of hidden applications translucent
  199. defaults write com.apple.dock showhidden -bool true
  200. # Don’t show recent applications in Dock
  201. defaults write com.apple.dock show-recents -bool false
  202. # Add iOS & Watch Simulator to Launchpad
  203. sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app" "/Applications/Simulator.app"
  204. sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/Simulator (Watch).app" "/Applications/Simulator (Watch).app"
  205. # Add a spacer to the left side of the Dock (where the applications are)
  206. #defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
  207. # Press Tab to highlight each item on a web page
  208. defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
  209. defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
  210. # Show the full URL in the address bar (note: this still hides the scheme)
  211. defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
  212. # Prevent Safari from opening ‘safe’ files automatically after downloading
  213. defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
  214. # Don't allow hitting the Backspace key to go to the previous page in history
  215. defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool false
  216. # Hide Safari’s bookmarks bar by default
  217. defaults write com.apple.Safari ShowFavoritesBar -bool false
  218. # Enable Safari’s debug menu
  219. defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
  220. # Remove useless icons from Safari’s bookmarks bar
  221. defaults write com.apple.Safari ProxiesInBookmarksBar "()"
  222. # Enable the Develop menu and the Web Inspector in Safari
  223. defaults write com.apple.Safari IncludeDevelopMenu -bool true
  224. defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
  225. defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
  226. # Add a context menu item for showing the Web Inspector in web views
  227. defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
  228. # Disable AutoFill
  229. defaults write com.apple.Safari AutoFillFromAddressBook -bool false
  230. defaults write com.apple.Safari AutoFillPasswords -bool false
  231. defaults write com.apple.Safari AutoFillCreditCardData -bool false
  232. defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false
  233. # Warn about fraudulent websites
  234. defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
  235. # Block pop-up windows
  236. defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
  237. defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
  238. # Disable auto-playing video
  239. defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false
  240. defaults write com.apple.SafariTechnologyPreview WebKitMediaPlaybackAllowsInline -bool false
  241. defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
  242. defaults write com.apple.SafariTechnologyPreview com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
  243. # Enable “Do Not Track”
  244. defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
  245. # Update extensions automatically
  246. defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
  247. # Disable send and reply animations in Mail.app
  248. defaults write com.apple.mail DisableReplyAnimations -bool true
  249. defaults write com.apple.mail DisableSendAnimations -bool true
  250. # Disable Safari’s thumbnail cache for History and Top Sites
  251. defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
  252. # Copy email addresses as `foo@example.com` instead of `Foo Bar <foo@example.com>` in Mail.app
  253. defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
  254. # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
  255. defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9"
  256. # Display emails in threaded mode, sorted by date (newest at the top)
  257. defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
  258. defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "no"
  259. defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date"
  260. # Disable inline attachments (just show the icons)
  261. defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
  262. # Change indexing order and disable some search results
  263. defaults write com.apple.spotlight orderedItems -array \
  264. '{"enabled" = 1;"name" = "APPLICATIONS";}' \
  265. '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
  266. '{"enabled" = 1;"name" = "DIRECTORIES";}' \
  267. '{"enabled" = 1;"name" = "PDF";}' \
  268. '{"enabled" = 1;"name" = "FONTS";}' \
  269. '{"enabled" = 0;"name" = "DOCUMENTS";}' \
  270. '{"enabled" = 0;"name" = "MESSAGES";}' \
  271. '{"enabled" = 0;"name" = "CONTACT";}' \
  272. '{"enabled" = 0;"name" = "EVENT_TODO";}' \
  273. '{"enabled" = 0;"name" = "IMAGES";}' \
  274. '{"enabled" = 0;"name" = "BOOKMARKS";}' \
  275. '{"enabled" = 0;"name" = "MUSIC";}' \
  276. '{"enabled" = 0;"name" = "MOVIES";}' \
  277. '{"enabled" = 0;"name" = "PRESENTATIONS";}' \
  278. '{"enabled" = 0;"name" = "SPREADSHEETS";}' \
  279. '{"enabled" = 0;"name" = "SOURCE";}'
  280. # Load new settings before rebuilding the index
  281. killall mds > /dev/null 2>&1
  282. # Make sure indexing is enabled for the main volume
  283. sudo mdutil -i on / > /dev/null
  284. # Rebuild the index from scratch
  285. sudo mdutil -E / > /dev/null
  286. # Disable the annoying line marks
  287. defaults write com.apple.Terminal ShowLineMarks -int 0
  288. # Don’t display the annoying prompt when quitting iTerm
  289. defaults write com.googlecode.iterm2 PromptOnQuit -bool false
  290. # Show the main window when launching Activity Monitor
  291. defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
  292. # Visualize CPU usage in the Activity Monitor Dock icon
  293. defaults write com.apple.ActivityMonitor IconType -int 5
  294. # Show all processes in Activity Monitor
  295. defaults write com.apple.ActivityMonitor ShowCategory -int 0
  296. # Sort Activity Monitor results by CPU usage
  297. defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
  298. defaults write com.apple.ActivityMonitor SortDirection -int 0
  299. # Enable the debug menu in Address Book
  300. defaults write com.apple.addressbook ABShowDebugMenu -bool true
  301. # Enable the debug menu in Disk Utility
  302. defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
  303. defaults write com.apple.DiskUtility advanced-image-options -bool true
  304. # Don't autoplay videos when opened with QuickTime Player
  305. defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen -bool false
  306. # Enable the WebKit Developer Tools in the Mac App Store
  307. defaults write com.apple.appstore WebKitDeveloperExtras -bool true
  308. # Enable Debug Menu in the Mac App Store
  309. defaults write com.apple.appstore ShowDebugMenu -bool true
  310. # Enable the automatic update check
  311. defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
  312. # Check for software updates daily, not just once per week
  313. defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
  314. # Download newly available updates in background
  315. defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1
  316. # Install System data files & security updates
  317. defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1
  318. # Turn on app auto-update
  319. defaults write com.apple.commerce AutoUpdate -bool true
  320. # Prevent Photos from opening automatically when devices are plugged in
  321. defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
  322. # Disable automatic emoji substitution (i.e. use plain text smileys)
  323. defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false
  324. # Disable the all too sensitive backswipe on trackpads
  325. defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
  326. defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false
  327. defaults write com.mozilla.Firefox AppleEnableSwipeNavigateWithScrolls -bool false
  328. # Disable the all too sensitive backswipe on Magic Mouse
  329. defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
  330. defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false
  331. # Expand the print dialog by default
  332. defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
  333. defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true
  334. # Use `~/Documents/Torrents` to store incomplete downloads
  335. defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true
  336. defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents"
  337. # Use `~/Downloads` to store completed downloads
  338. defaults write org.m0k.transmission DownloadLocationConstant -bool true
  339. # Don’t prompt for confirmation before removing non-downloading active transfers
  340. defaults write org.m0k.transmission CheckRemoveDownloading -bool true
  341. # Trash original torrent files
  342. defaults write org.m0k.transmission DeleteOriginalTorrent -bool true
  343. # Hide the donate message
  344. defaults write org.m0k.transmission WarningDonate -bool false
  345. # Hide the legal disclaimer
  346. defaults write org.m0k.transmission WarningLegal -bool false
  347. # IP block list.
  348. # Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/
  349. defaults write org.m0k.transmission BlocklistNew -bool true
  350. defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz"
  351. defaults write org.m0k.transmission BlocklistAutoUpdate -bool true
  352. # Randomize port on launch
  353. defaults write org.m0k.transmission RandomPort -bool true
  354. # Enable the hidden ‘Develop’ menu
  355. defaults write com.twitter.twitter-mac ShowDevelopMenu -bool true
  356. # Bypass the annoyingly slow t.co URL shortener
  357. defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true
  358. # fix location
  359. defaults write com.apple.Dock size-immutable -bool yes
  360. # improve Safari security
  361. defaults write com.apple.Safari \
  362. com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled \
  363. -bool false
  364. defaults write com.apple.Safari \
  365. com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles \
  366. -bool false
  367. # diable automatic period substitution
  368. defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
  369. # allow text selection in Quick Look
  370. defaults write com.apple.finder QLEnableTextSelection -bool true
  371. defaults write com.apple.dock wvous-tl-corner -int 0
  372. defaults write com.apple.dock wvous-tr-corner -int 0
  373. defaults write com.apple.dock wvous-bl-corner -int 0
  374. defaults write com.apple.dock wvous-br-corner -int 0
  375. # Disable indexing of Time Machine backup drive
  376. sudo mdutil -i off /Volumes/ThunderBox
  377. # Multiple cursors (cmd+click)
  378. # https://twitter.com/dmartincy/status/988094014804160514
  379. defaults write com.apple.dt.Xcode PegasusMultipleCursorsEnabled -bool true
  380. # Show build times - http://stackoverflow.com/questions/1027923/how-to-enable-build-timing-in-xcode#answer-2801156
  381. defaults write com.apple.dt.Xcode ShowBuildOperationDuration YES
  382. # Xcode 13.3 beta 1 Swift compiler new mode that better utilizes available
  383. # cores, resulting in faster builds for Swift projects.
  384. defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
  385. defaults write com.macromates.TextMate.preview fileBrowserSingleClickToOpen -bool true
  386. # Disable OSX Mail app auto loading (malicious) remote content in e-mails
  387. defaults write com.apple.mail-shared DisableURLLoading -bool true
  388. defaults write com.apple.sidecar.display AllowAllDevices -bool true; defaults write com.apple.sidecar.display hasShownPref -bool true; open /System/Library/PreferencePanes/Sidecar.prefPane
  389. defaults write com.pixelmatorteam.pixelmator PXCEnableOpenCLCPUBlit -bool no
  390. # Increase launchpad density
  391. defaults write com.apple.dock springboard-columns -int 8
  392. defaults write com.apple.dock springboard-rows -int 6
  393. # Speed up time machine backups
  394. sudo sysctl debug.lowpri_throttle_enabled=0
  395. defaults write -g QLPanelAnimationDuration -float 0
  396. defaults write com.apple.Safari WebKitInitialTimedLayoutDelay 0.25
  397. # To improve performance Safari will attempt to prefetch DNS information. In some circumstances this can result in slow or partial webpage loading, or webpage cannot be found errors.
  398. # If you are experiencing those problems, apply this tweak to disable DNS prefetching.
  399. #defaults write com.apple.safari WebKitDNSPrefetchingEnabled -boolean false
  400. defaults write com.apple.CrashReporter UseUNC 1
  401. # Hide icons on desktop
  402. defaults write com.apple.finder CreateDesktop -bool FALSE
  403. defaults write -g NSWindowResizeTime -float 0.001
  404. # Disable Dashboard
  405. defaults write com.apple.dashboard mcx-disabled -boolean true
  406. defaults write NSGlobalDomain NSWindowResizeTime .1
  407. # Disable Resume
  408. #defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
  409. defaults write com.apple.iTunes allow-half-stars -bool true
  410. defaults write com.apple.dock springboard-show-duration -int 0
  411. defaults write com.apple.dock springboard-hide-duration -int 0
  412. defaults write com.apple.finder ProhibitEmptyTrash -bool false
  413. # Disable personalized advertisements and identifier tracking
  414. echo '--- Disable personalized advertisements and identifier tracking'
  415. defaults write com.apple.AdLib allowIdentifierForAdvertising -bool false
  416. defaults write com.apple.AdLib allowApplePersonalizedAdvertising -bool false
  417. defaults write com.apple.AdLib forceLimitAdTracking -bool true
  418. # Disable remote Apple events
  419. sudo systemsetup -setremoteappleevents off
  420. # Disable "Do you want to enable Siri?" pop-up
  421. defaults write com.apple.SetupAssistant 'DidSeeSiriSetup' -bool True
  422. # Disable remote management service
  423. sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -deactivate -stop
  424. # Disable PowerShell telemetry
  425. echo '--- Disable PowerShell Core telemetry'
  426. command='export POWERSHELL_TELEMETRY_OPTOUT=1'
  427. declare -a profile_files=("$HOME/.bash_profile" "$HOME/.zprofile")
  428. for profile_file in "${profile_files[@]}"
  429. do
  430. touch "$profile_file"
  431. if ! grep -q "$command" "${profile_file}"; then
  432. echo "$command" >> "$profile_file"
  433. fi
  434. done
  435. # Disable .NET Core CLI telemetry
  436. command='export DOTNET_CLI_TELEMETRY_OPTOUT=1'
  437. declare -a profile_files=("$HOME/.bash_profile" "$HOME/.zprofile")
  438. for profile_file in "${profile_files[@]}"
  439. do
  440. touch "$profile_file"
  441. if ! grep -q "$command" "${profile_file}"; then
  442. echo "$command" >> "$profile_file"
  443. fi
  444. done
  445. # Opt-out of homebrew analytics
  446. export HOMEBREW_NO_ANALYTICS=1
  447. # Disable Microsoft Office telemetry'
  448. defaults write com.microsoft.office DiagnosticDataTypePreference -string ZeroDiagnosticData
  449. # Enable Firefox policies so the telemetry can be configured.
  450. sudo defaults write /Library/Preferences/org.mozilla.firefox EnterprisePoliciesEnabled -bool TRUE
  451. # Disable sending usage data
  452. sudo defaults write /Library/Preferences/org.mozilla.firefox DisableTelemetry -bool TRUE
  453. # Disable Parallels Desktop advertisements
  454. defaults write 'com.parallels.Parallels Desktop' 'ProductPromo.ForcePromoOff' -bool yes
  455. defaults write 'com.parallels.Parallels Desktop' 'WelcomeScreenPromo.PromoOff' -bool yes
  456. # Disable participation in Siri data collection
  457. defaults write com.apple.assistant.support 'Siri Data Sharing Opt-In Status' -int 2
  458. # Enable stealth mode
  459. /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode on
  460. sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -bool true
  461. defaults write com.apple.security.firewall EnableStealthMode -bool true
  462. # Enable application firewall
  463. /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
  464. sudo defaults write /Library/Preferences/com.apple.alf globalstate -bool true
  465. defaults write com.apple.security.firewall EnableFirewall -bool true
  466. # Disable guest sign-in from login screen
  467. sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool NO
  468. # Disable guest access to file shares over AF
  469. sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO
  470. # Disable guest access to file shares over SMB'
  471. sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO
  472. # Disable insecure telnet protocol
  473. sudo launchctl disable system/com.apple.telnetd
  474. # Disable the insecure TFTP service
  475. sudo launchctl disable 'system/com.apple.tftpd'
  476. # Disable Bonjour multicast advertising
  477. sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool true
  478. # Disable Captive portal
  479. sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control.plist Active -bool false
  480. # Disable macOS beta release installation for OS X Yosemite and newer (>= 10.10)
  481. sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate 'AllowPreReleaseInstallation' -bool false
  482. # Set wallpaper
  483. #osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/path/to/image.jpg"'
  484. # TODO figure out how to set desktop wallpaper to https://images.unsplash.com/photo-1615195627275-48660e9cd84f?q=80&w=2911&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D
  485. # sudo defaults write /Library/Preferences/com.apple.loginwindow DesktopPicture ""
  486. # Ensure changes are applied
  487. for app in "Activity Monitor" \
  488. "Address Book" \
  489. "Calendar" \
  490. "cfprefsd" \
  491. "Contacts" \
  492. "Dock" \
  493. "Finder" \
  494. "Google Chrome Canary" \
  495. "Google Chrome" \
  496. "Firefox" \
  497. "Mail" \
  498. "Messages" \
  499. "Opera" \
  500. "Photos" \
  501. "Safari" \
  502. "SizeUp" \
  503. "Spectacle" \
  504. "SystemUIServer" \
  505. "Terminal" \
  506. "Transmission" \
  507. "Tweetbot" \
  508. "Twitter" \
  509. "iCal"; do
  510. killall "${app}" &> /dev/null
  511. done
  512. # Finishing touches
  513. echo "Configured your MacOS sucessfully! Some changes may require restart."
  514. if read -q "choice?Press Y/y to restart now: "; then
  515. restart
  516. else
  517. echo
  518. fi
  519. }
  520. #brew install progress
  521. defaultsset #& progress -mp $!