Skip to content

Instantly share code, notes, and snippets.

@lgw4
Last active July 25, 2022 19:52
Show Gist options
  • Save lgw4/7144833 to your computer and use it in GitHub Desktop.
Save lgw4/7144833 to your computer and use it in GitHub Desktop.
macOS Post-Install Configuration
#!/usr/bin/env sh
# Set computer name
if [ $# -ne 1 ] && [ "$1" = "" ]; then
echo "Missing computer name. Exiting."
exit
fi
COMPUTER_NAME="$1"
HOST_NAME=$(echo "$COMPUTER_NAME" | tr '[:upper:]' '[:lower:]')
sudo scutil --set ComputerName "$COMPUTER_NAME"
sudo scutil --set HostName "$HOST_NAME"
sudo scutil --set LocalHostName "$HOST_NAME"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$COMPUTER_NAME"
# Configure Dock
defaults write com.apple.dock orientation -string "left"
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock minimize-to-application -bool true
defaults write com.apple.dock tilesize -int 48
defaults write com.apple.dock showhidden -bool true
defaults write com.apple.dock autohide-delay -float 0
killall Dock
# Set minimum font size for Safari
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2MinimumFontSize 13
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2MinimumFixedFontSize 13
# Disable video autoplay in Safari
defaults write com.apple.Safari WebKitMediaPlaybackAllowsInline -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2AllowsInlineMediaPlayback -bool false
# Enable debug menu in Safari
defaults write com.apple.Safari IncludeInternalDebugMenu 1
# Restore Save As… to File menu
defaults write -globalDomain NSUserKeyEquivalents -dict-add 'Save As...' '@$S'
# Enable debug menu in Mac App Store
defaults write com.apple.appstore ShowDebugMenu -bool true
# Disable shadows in screenshots
defaults write com.apple.screencapture "disable-shadow" -bool true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment