Skip to content

Instantly share code, notes, and snippets.

@nmbr73
Last active August 31, 2022 21:38
Show Gist options
  • Save nmbr73/923f3bd52a283fcff6f786108d48633d to your computer and use it in GitHub Desktop.
Save nmbr73/923f3bd52a283fcff6f786108d48633d to your computer and use it in GitHub Desktop.
Change some preferences on a freshly installed macOS
#!/bin/bash
# ============================================================================
# Some defaults I change on a new Mac ... done via shell script to
# not have to do it manually. These settings are personal preference,
# but the commands might be helpful if you want to write your own such
# script. Seems to work on Monterey; don't know for Ventura.
# ============================================================================
# PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND!
# USE AT YOUR VERY OWN RISK!!!!
# ----------------------------------------------------------------------------
# System Preferences / Keyboard / Text
# ----------------------------------------------------------------------------
# Correct spelling automatically -> off
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Capitalize words automatically -> off
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
# Add full stop with double-space -> off
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
# ----------------------------------------------------------------------------
# System Preferences / Dock & Menu Bar
# ----------------------------------------------------------------------------
# Automatically hide and show the dock -> on
defaults write com.apple.dock autohide -bool true
# Minimise window using: -> Scale effect ('scale' instead of 'genie')
# 'scale' is faster than 'genie'
defaults write com.apple.dock mineffect -string scale
# Use an icon size of 42px to make the dock smaller
defaults write com.apple.dock tilesize -int 42
# Show recent applications in Dock -> off
defaults write com.apple.dock "show-recents" -bool false
# ----------------------------------------------------------------------------
# Dock (not accesible via the UI)
# ----------------------------------------------------------------------------
# No delay when showing/hiding the Dock (set to 0.5 to undo)
defaults write com.apple.Dock autohide-delay -float 0
# No animation when showing/hiding the Dock (set to 0.5 to undo)
defaults write com.apple.dock autohide-time-modifier -float 0
# Hidden aplications (CMD+H) shown with translucent icons
defaults write com.apple.dock showhidden -bool true
# Add some spacers to organize the Dock
# You can use "spacer-tile" instead of "small-spacer-tile" to have some larger spacers.
# Execute the command to create as many spacers as needed. These spacers can be moved and
# removed just like normal apps.
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="small-spacer-tile";}'
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="small-spacer-tile";}'
defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="small-spacer-tile";}'
# ----------------------------------------------------------------------------
# System Preferences / Desktop & Screen Saver
# ----------------------------------------------------------------------------
# Screen Saver / Hot Corners... / Bottom Right -> "Desktop"
# No one needs "Quick Note" to be here on a Mac
defaults write com.apple.dock wvous-br-corner -int 4
defaults write com.apple.dock wvous-br-modifier -int 0
# ----------------------------------------------------------------------------
# Finder Preferences / General
# ----------------------------------------------------------------------------
# Show these items on the desktop
# (do as you wish - I prefer it being as follows)
# Hard disks -> off
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
# External disks -> on
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
# CDs, DVDs and iPods -> on
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# Connected servers -> off
defaults write com.apple.finder ShowMountedServersOnDesktop -bool false
# New Finder windows show -> User's home directory (instead of Recents)
defaults write com.apple.finder NewWindowTargetPath -string "file:///Users/$(whoami)/"
# ----------------------------------------------------------------------------
# Finder Preferences / Advanced
# ----------------------------------------------------------------------------
# Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# ----------------------------------------------------------------------------
# Finder / View
# ----------------------------------------------------------------------------
# View / Show Status Bar -> on
defaults write com.apple.finder ShowStatusBar -bool true
# View -> Show Path Bar -> on
defaults write com.apple.finder ShowPathbar -bool true
# ============================================================================
# Restart Finder and Dock for the changes to take effect
killall Finder
killall Dock
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment