Show Info

Copyright © 2018

By Jip · 03 Nov, 2018


Mac default settings

#!/usr/bin/env bash

# Adapted from

set -x

if [[ -z “${CI}” ]]; then
sudo -v # Ask for the administrator password upfront
# Keep-alive: update existing `sudo` time stamp until script has finished
while true; do sudo -n true; sleep 60; kill -0 “$$” || exit; done 2>/dev/null &

# Disable the sound effects on boot
sudo nvram SystemAudioVolume=” ”

# 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’

# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true

# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

# Save to disk (not to iCloud) by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

# Automatically quit printer app once the print jobs complete
defaults write “Quit When Finished” -bool true

# Disable the “Are you sure you want to open this application?” dialog
defaults write LSQuarantine -bool false

# Reveal IP address, hostname, OS version, etc. when clicking the clock in the login window
sudo defaults write /Library/Preferences/ AdminHostInfo HostName

# Enable full keyboard access for all controls e.g. enable Tab in modal dialogs
# defaults write NSGlobalDomain AppleKeyboardUIMode -int 3

# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write QuitMenuItem -bool true

# Set Desktop as the default location for new Finder windows
defaults write NewWindowTarget -string “PfDe”
defaults write NewWindowTargetPath -string “file://${HOME}/Desktop/”

# defaults write AppleShowAllFiles -bool true # Finder: Show hidden files by default
# defaults write NSGlobalDomain AppleShowAllExtensions -bool true # Finder: Show all filename extensions
defaults write ShowStatusBar -bool true # Finder: Show status bar
defaults write ShowPathbar -bool true # Finder: Show path bar
# defaults write _FXShowPosixPathInTitle -bool true # Finder: Display full POSIX path as window title
defaults write _FXSortFoldersFirst -bool true # Finder: Keep folders on top when sorting by name
# chflags nohidden ~/Library # Show the ~/Library folder
# sudo chflags nohidden /Volumes # Show the /Volumes folder

# Avoid creating .DS_Store files on network or USB volumes
# defaults write DSDontWriteNetworkStores -bool true
# defaults write DSDontWriteUSBStores -bool true

# Automatically open a new Finder window when a volume is mounted
defaults write auto-open-ro-root -bool true
defaults write auto-open-rw-root -bool true
defaults write OpenWindowForNewRemovableDisk -bool true

# Use list view in all Finder windows by default (codes for the other view modes: `icnv`, `clmv`, `Flwv`)
defaults write FXPreferredViewStyle -string “Nlsv”

# Expand the following File Info panes:
# “General”, “Open with”, and “Sharing & Permissions”
defaults write FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true

# Don’t automatically rearrange Spaces based on most recent use
defaults write mru-spaces -bool false

# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write DoNotOfferNewDisksForBackup -bool true

# Show the main window when launching Activity Monitor
defaults write OpenMainWindow -bool true

# Visualize CPU usage in the Activity Monitor Dock icon
defaults write IconType -int 5

# Show all processes in Activity Monitor
defaults write ShowCategory -int 0

# Sort Activity Monitor results by CPU usage
defaults write SortColumn -string “CPUUsage”
defaults write SortDirection -int 0

# Disable Auto Update
softwareupdate –schedule off