|
#!/usr/bin/env bash |
|
|
|
#### |
|
# |
|
# https://macos-defaults.com |
|
# |
|
#### |
|
|
|
# Close any open System Preferences panes, to prevent them from overriding |
|
# settings we’re about to change |
|
osascript -e 'tell application "System Preferences" to quit' |
|
|
|
# Ask for the administrator password upfront |
|
sudo -v |
|
|
|
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished |
|
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & |
|
|
|
|
|
# GENERAL ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
|
|
# Disable the sound effects on boot |
|
sudo nvram SystemAudioVolume=" " |
|
|
|
# NOTE: use '$ defaults read NSGlobalDomain' to read current values |
|
|
|
# Disable the “Are you sure you want to open this application?” dialog |
|
defaults write com.apple.LaunchServices LSQuarantine -bool false |
|
|
|
# Disable auto-correct. OH YEAH PLEASE! |
|
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false |
|
|
|
# Set language and text formats |
|
defaults write NSGlobalDomain AppleLanguages -array "en" "hu" "sr_Latn" |
|
defaults write NSGlobalDomain AppleLocale -string "en_NL@currency=EUR" |
|
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" |
|
defaults write NSGlobalDomain AppleMetricUnits -bool true |
|
|
|
# Set the timezone |
|
sudo systemsetup -settimezone "Europe/Amsterdam" > /dev/null |
|
|
|
# Disable hibernation |
|
sudo pmset -a hibernatemode 0 |
|
|
|
# KEYBOARD ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
|
|
# Fn key does nothing ie. no emoji by default |
|
defaults write com.apple.HIToolbox AppleFnUsageType -int "0" |
|
|
|
# Disable press and hold for accents |
|
defaults write -g ApplePressAndHoldEnabled -bool false |
|
|
|
# FINDER ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
|
|
# Show icons for hard drives, servers, and removable media on the desktop |
|
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true |
|
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true |
|
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true |
|
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true |
|
|
|
# Disable window animations |
|
defaults write com.apple.finder DisableAllAnimations -bool true |
|
|
|
# Disable warning when changing a file extension |
|
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false |
|
|
|
# Avoid creating .DS_Store files on network or USB volumes |
|
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true |
|
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true |
|
|
|
# Automatically open a new Finder window when a volume is mounted |
|
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true |
|
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true |
|
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true |
|
|
|
# Set home as default location for new Finder windows |
|
defaults write com.apple.finder NewWindowTarget -string "PfHm" |
|
|
|
# Show status & path bar |
|
defaults write com.apple.finder ShowStatusBar -bool true |
|
defaults write com.apple.finder ShowPathbar -bool true |
|
|
|
# Keep folders on top when sorting by name |
|
defaults write com.apple.finder _FXSortFoldersFirst -bool true |
|
|
|
# Search the current folder by default |
|
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" |
|
|
|
# Set grid spacing for icons on the desktop and in other icon views |
|
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 64" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 64" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 64" ~/Library/Preferences/com.apple.finder.plist |
|
|
|
# Set icons size on the desktop and in other icon views |
|
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 48" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 48" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 48" ~/Library/Preferences/com.apple.finder.plist |
|
|
|
# Use icon view in all Finder windows by default |
|
# Four-letter codes for the other view modes: 'Nlsv', 'clmv', 'glyv' |
|
defaults write com.apple.finder FXPreferredViewStyle -string "icnv" |
|
|
|
# Show the ~/Library folder |
|
chflags nohidden ~/Library |
|
|
|
# Create user Sites directory |
|
mkdir -p "$HOME/Sites" |
|
|
|
|
|
# DOCK :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
|
|
# Set the icon size of Dock items |
|
defaults write com.apple.dock tilesize -int 32 |
|
|
|
# Minimize windows into their application’s icon |
|
defaults write com.apple.dock minimize-to-application -bool true |
|
|
|
# Wipe all default app icons from the Dock |
|
defaults write com.apple.dock persistent-apps -array |
|
|
|
# Don’t show recent applications in Dock |
|
defaults write com.apple.dock show-recents -bool false |
|
|
|
|
|
# NETWORK ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: |
|
|
|
# Set default Cloudflare DNS (and Google as fallback) |
|
networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1 8.8.8.8 |