1+ #! /usr/bin/env bash
2+
3+ # Adapted from https://github.com/mathiasbynens/dotfiles/blob/master/.macos
4+
5+ set -x
6+
7+ if [[ -z " ${CI} " ]]; then
8+ sudo -v # Ask for the administrator password upfront
9+ # Keep-alive: update existing `sudo` time stamp until script has finished
10+ while true ; do sudo -n true ; sleep 60; kill -0 " $$ " || exit ; done 2> /dev/null &
11+ fi
12+
13+ # Trackpad: enable tap to click for this user and for the login screen
14+ defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
15+ defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
16+ defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
17+
18+ # Disable the sound effects on boot
19+ sudo nvram SystemAudioVolume=" "
20+
21+ # Close any open System Preferences panes, to prevent them from overriding settings we’re about to change
22+ osascript -e ' tell application "System Preferences" to quit'
23+
24+ # Expand save panel by default
25+ defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
26+ defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
27+
28+ # Expand print panel by default
29+ defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
30+ defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
31+
32+ # Save to disk (not to iCloud) by default
33+ defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
34+
35+ # Automatically quit printer app once the print jobs complete
36+ defaults write com.apple.print.PrintingPrefs " Quit When Finished" -bool true
37+
38+ # Disable the “Are you sure you want to open this application?” dialog
39+ defaults write com.apple.LaunchServices LSQuarantine -bool false
40+
41+ # Reveal IP address, hostname, OS version, etc. when clicking the clock in the login window
42+ sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
43+
44+ # Disable auto corrections
45+ defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false # Disable automatic capitalization
46+ defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false # Disable smart dashes
47+ defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false # Disable automatic period substitution
48+ defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false # Disable smart quotes
49+ defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false # Disable auto-correct
50+
51+ # Enable full keyboard access for all controls e.g. enable Tab in modal dialogs
52+ defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
53+
54+ # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
55+ defaults write com.apple.finder QuitMenuItem -bool true
56+
57+ # Set Desktop as the default location for new Finder windows
58+ defaults write com.apple.finder NewWindowTarget -string " PfDe"
59+ defaults write com.apple.finder NewWindowTargetPath -string " file://${HOME} /Desktop/"
60+
61+ defaults write com.apple.finder AppleShowAllFiles -bool true # Finder: Show hidden files by default
62+ defaults write NSGlobalDomain AppleShowAllExtensions -bool true # Finder: Show all filename extensions
63+ defaults write com.apple.finder ShowStatusBar -bool true # Finder: Show status bar
64+ defaults write com.apple.finder ShowPathbar -bool true # Finder: Show path bar
65+ defaults write com.apple.finder _FXShowPosixPathInTitle -bool true # Finder: Display full POSIX path as window title
66+ defaults write com.apple.finder _FXSortFoldersFirst -bool true # Finder: Keep folders on top when sorting by name
67+ chflags nohidden ~ /Library # Show the ~/Library folder
68+ sudo chflags nohidden /Volumes # Show the /Volumes folder
69+
70+ # Avoid creating .DS_Store files on network or USB volumes
71+ defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
72+ defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
73+
74+ # Automatically open a new Finder window when a volume is mounted
75+ defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
76+ defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
77+ defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
78+
79+ # Use list view in all Finder windows by default (codes for the other view modes: `icnv`, `clmv`, `Flwv`)
80+ defaults write com.apple.finder FXPreferredViewStyle -string " Nlsv"
81+
82+ # Expand the following File Info panes:
83+ # “General”, “Open with”, and “Sharing & Permissions”
84+ defaults write com.apple.finder FXInfoPanesExpanded -dict \
85+ General -bool true \
86+ OpenWith -bool true \
87+ Privileges -bool true
88+
89+ # Don’t automatically rearrange Spaces based on most recent use
90+ defaults write com.apple.dock mru-spaces -bool false
91+
92+ # Automatically hide and show the Dock
93+ defaults write com.apple.dock autohide -bool true
94+
95+ # Put the Dock on the left of the screen
96+ defaults write com.apple.dock orientation -string " left"
97+
98+ # Prevent Time Machine from prompting to use new hard drives as backup volume
99+ defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
100+
101+ # Show the main window when launching Activity Monitor
102+ defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
103+
104+ # Visualize CPU usage in the Activity Monitor Dock icon
105+ defaults write com.apple.ActivityMonitor IconType -int 5
106+
107+ # Show all processes in Activity Monitor
108+ defaults write com.apple.ActivityMonitor ShowCategory -int 0
109+
110+ # Sort Activity Monitor results by CPU usage
111+ defaults write com.apple.ActivityMonitor SortColumn -string " CPUUsage"
112+ defaults write com.apple.ActivityMonitor SortDirection -int 0
0 commit comments