If you want to automate the setup of your mac, you'll quickly learn that there are many things about can configure via commands in the terminal.

If you save together into a script, can you automate a lot of the tedious setup when moving to a different machine.

Here's a list of useful things you can configure this way:

Finder

After you've updated these settings, you'll need to restart the Finder by executing:

killall Finder
  • Disable the screensaver:

    defaults -currentHost write com.apple.screensaver "idleTime" -int 0
    
  • Setting dark mode:

    defaults write -g AppleInterfaceStyle -string "Dark"
    
  • Show hidden files in the finder:

    defaults write com.apple.finder "AppleShowAllFiles" -bool true
    
  • Show file extensions in Finder:

    defaults write -globalDomain "AppleShowAllExtensions" -bool true
    
  • Show path bar in Finder

    defaults write com.apple.finder "ShowPathbar" -bool "true"
    
  • Hide Macintosh HD on desktop

    defaults write com.apple.finder "ShowHardDrivesOnDesktop" -bool false
    
  • Show external and removable harddrives on desktop:

    defaults write com.apple.finder "ShowExternalHardDrivesOnDesktop" -bool true
    defaults write com.apple.finder "ShowRemovableMediaOnDesktop" -bool true
    
  • Use column view by default in Finder

    defaults write com.apple.Finder "FXPreferredViewStyle" clmv
    
  • Set Finder sidebar icon size to small:

    defaults write -g NSTableViewDefaultSizeMode -int 1
    
  • Avoid creating .DS_Store files on network and USB volumes:

    defaults write com.apple.desktopservices "DSDontWriteNetworkStores" -bool true
    defaults write com.apple.desktopservices "DSDontWriteUSBStores" -bool true
    
  • Expand save panel by default:

    defaults write -g "NSNavPanelExpandedStateForSaveMode" -bool true
    
  • Show the ~/Library folder:

    chflags nohidden ~/Library
    
  • Set home as the default location for new Finder windows:

    defaults write com.apple.finder NewWindowTarget -string "PfHm"
    defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
    

Dock

After you've updated these settings, you'll need to restart the Finder by executing:

killall Dock
  • Auto-hide dock:

    defaults write com.apple.dock "autohide" -bool true
    
  • Don't show recent apps in dock:

    defaults write com.apple.dock "show-recents" -bool false
    
  • Set the icon size of Dock items to 36 pixels:

    defaults write com.apple.dock tilesize -int 36
    

Input

  • Set fast key-repeat-rate:

    defaults write -globalDomain "InitialKeyRepeat" -int 15
    defaults write -globalDomain "KeyRepeat" -int 2
    
  • Set fast scroll speed:

    defaults write -globalDomain "com.apple.mouse.scaling" -int 2
    defaults write -globalDomain "com.apple.trackpad.scaling" -int 2
    
  • Enable tab to click:

    defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad "Clicking" -bool true
    defaults write com.apple.AppleMultitouchTrackpad "Clicking" -bool true
    defaults -currentHost write -globalDomain "com.apple.mouse.tapBehavior" -int 1
    
  • Enable mouse right-click:

    defaults write "com.apple.driver.AppleBluetoothMultitouch.mouse" MouseButtonMode TwoButton
    defaults write "com.apple.AppleMultitouchMouse.plist" MouseButtonMode TwoButton
    
  • Disable press-and-hold for keys in favor of key repeat:

    defaults write -g ApplePressAndHoldEnabled -bool false
    
  • Show scrollbars when scrolling:

    defaults write -g AppleShowScrollBars -string "WhenScrolling"
    
  • Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs):

    defaults write -g AppleKeyboardUIMode -int 3
    

Language & Region

  • Set language and text formats:
    defaults write -g AppleLanguages -array "en-US"
    defaults write -g AppleLocale -string "en_US@currency=EUR"
    defaults write -g AppleMeasurementUnits -string "Centimeters"
    defaults write -g AppleTemperatureUnit -string "Celsius"
    defaults write -g AppleMetricUnits -bool true
    

You can find more macOS defaults here: