Skip to content

Instantly share code, notes, and snippets.

@kondratovbr
Created January 24, 2024 09:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kondratovbr/d5d077139d0d88a59f563bcb6ce68797 to your computer and use it in GitHub Desktop.
Save kondratovbr/d5d077139d0d88a59f563bcb6ce68797 to your computer and use it in GitHub Desktop.
macOS dev settings script
# May be ran as any user
###############################################################################
# General UI/UX
###############################################################################
# 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
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Enable automatic termination of inactive apps
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool false
###############################################################################
# Dock, dashboard, Mission Control and Expose
###############################################################################
# Making macOS Dock faster:
# Automatically hide and show the Dock
# Set autohide delay at 0 (default - 1)
# Half the duration of autohide animation (default - 1)
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0.5
# Enable highlight hover effect for the grid view of a stack (Dock)
#defaults write com.apple.dock mouse-over-hilite-stack -bool true
# Minimize windows into window icons
#defaults write com.apple.dock minimize-to-application -bool false
# Alternatively:
# Minimize windows into their application’s icon
#defaults write com.apple.dock minimize-to-application -bool true
# Show indicator lights for open applications in the Dock
#defaults write com.apple.dock show-process-indicators -bool true
# Disable Dashboard
#defaults write com.apple.dashboard mcx-disabled -bool true
# Don’t show Dashboard as a Space
#defaults write com.apple.dock dashboard-in-overlay -bool true
# Don’t automatically rearrange Spaces based on most recent use
#defaults write com.apple.dock mru-spaces -bool false
# And restart Dock
killall Dock
###############################################################################
# Finder
###############################################################################
# Finder: show hidden files by default
defaults write com.apple.finder AppleShowAllFiles -bool true
# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Disable the warning when changing a file extension
#defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# Keep folders on top when sorting by name
#defaults write com.apple.finder _FXSortFoldersFirst -bool true
# When performing a search, search the current folder by default
#defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# 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
# Enable snap-to-grid for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
# Use icons view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `glyv`, 'Nlsv'
defaults write com.apple.finder FXPreferredViewStyle -string "icnv"
# And restart Finder
killall Finder
###############################################################################
# Safari & WebKit
###############################################################################
# Show the full URL in the address bar (note: this still hides the scheme)
#defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
# Prevent Safari from opening ‘safe’ files automatically after downloading
#defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# Hide Safari’s bookmarks bar by default
#defaults write com.apple.Safari ShowFavoritesBar -bool false
# Enable the Develop menu and the Web Inspector in Safari
#defaults write com.apple.Safari IncludeDevelopMenu -bool true
#defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
# Warn about fraudulent websites
#defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
# Disable Java
defaults write com.apple.Safari WebKitJavaEnabled -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabledForLocalFiles -bool false
# Block pop-up windows
#defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
#defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool
# Enable “Do Not Track”
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
# Update extensions automatically
#defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
# And kill Safari just in case
killall Safari
###############################################################################
# Photos
###############################################################################
# Prevent Photos from opening automatically when devices are plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
# And kill Photos just in case
killall Photos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment