#!/bin/bash # The baseline settings every new Mac starts from: Finder, Dock, keyboard, # trackpad, menu-bar clock, Spotlight. Run it once, when setting a Mac up: # # ~/src/soarez/dot/macos-defaults.sh # # A private layer's bootstrap may run it on a new Mac; install.sh points to it # otherwise. Nothing runs it on its own, and nothing should: it # replaces the Dock with the three apps below and restarts Finder and the Dock. # A Mac is free to drift from these afterwards; this is where it starts, not a # state kept in sync. Asks for sudo, for the Spotlight setting. # # Reference: https://macos-defaults.com/ set -euo pipefail if [[ "$(uname)" != "Darwin" ]]; then >&2 echo "ERROR: macOS only" exit 1 fi # Show hidden files, filename extensions, full path & disable extension warning defaults write com.apple.finder "AppleShowAllFiles" -bool "true" defaults write NSGlobalDomain "AppleShowAllExtensions" -bool "true" defaults write com.apple.finder "ShowPathbar" -bool "true" defaults write com.apple.finder "FXEnableExtensionChangeWarning" -bool "false" # Set list view as default Finder view defaults write com.apple.finder "FXPreferredViewStyle" -string "Nlsv" # Set Dock size, autohide, recents defaults write com.apple.dock "tilesize" -int "46" defaults write com.apple.dock "autohide" -bool "true" defaults write com.apple.dock "show-recents" -bool "false" # Menubar date format defaults write com.apple.menuextra.clock "DateFormat" -string "\"HH:mm\"" # Three finger trackpad drag defaults write com.apple.AppleMultitouchTrackpad "TrackpadThreeFingerDrag" -bool "true" # Keyboard settings # disable FN (globe key) defaults write ~/Library/Preferences/com.apple.HIToolbox.plist 'AppleFnUsageType' -int 0 defaults write -g ApplePressAndHoldEnabled 0 # Use thin strokes defaults -currentHost write -g AppleFontSmoothing -int 0 # defaults -currentHost delete -g AppleFontSmoothing # Set dock apps: the app launcher, Alacritty, iPhone Mirroring. The launcher is # Launchpad up to macOS 15; macOS 26 has no Launchpad and calls it Apps. launcher=/System/Applications/Launchpad.app if [[ ! -e "${launcher}" ]]; then launcher=/System/Applications/Apps.app fi defaults delete com.apple.dock persistent-apps dock_item() { printf 'tile-datafile-data_CFURLString%s_CFURLStringType0' "$1" } defaults write com.apple.dock persistent-apps -array \ "$(dock_item "${launcher}")" \ "$(dock_item /Applications/Alacritty.app)" \ "$(dock_item '/System/Applications/iPhone Mirroring.app')" # Disable Spotlight indexing for any volume that gets mounted and has not yet # been indexed before. # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. sudo defaults write /Library/Preferences/com.apple.SpotlightServer.plist ExternalVolumesIgnore -bool true # Restart stuff killall Finder killall Dock