Update defaults script
This commit is contained in:
parent
039a70225b
commit
118b9b0669
2 changed files with 78 additions and 167 deletions
78
macos.sh
Executable file
78
macos.sh
Executable file
|
@ -0,0 +1,78 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# macos.sh
|
||||
# Set some better defaults
|
||||
|
||||
# This script uses `dialog`, so check its installed
|
||||
if ! (( $+commands[dialog] ))
|
||||
then
|
||||
echo "dialog command not installed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ask for the admin password upfront
|
||||
sudo -v
|
||||
|
||||
# Keep the sudo session alive
|
||||
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
||||
|
||||
BACKTITLE="macOS Setup"
|
||||
|
||||
# Duplicate (make a backup copy of) file descriptor 1
|
||||
# on descriptor 3
|
||||
exec 3>&1
|
||||
|
||||
CHOICES=$(dialog --backtitle $BACKTITLE \
|
||||
--clear \
|
||||
--checklist "Which settings would you like to change?" 20 80 10 \
|
||||
"1" "Expand save panel by default" "OFF" \
|
||||
"2" "Expand print panel by default" "OFF" \
|
||||
"3" "Automatically quit Printer app after job has finished" "OFF" \
|
||||
"4" "Check for software updates daily" "OFF" \
|
||||
"5" "Save screenshots in PNG format" "OFF" \
|
||||
"6" "Show all file extensions in Finder" "OFF" \
|
||||
"7" "Do not create .DS_Store files on network volumes" "OFF" \
|
||||
"8" "Disable warning when emptying Trash" "OFF" \
|
||||
2>&1 1>&3)
|
||||
|
||||
# Close file descriptor 3
|
||||
exec 3>&-
|
||||
|
||||
if [ -z "$CHOICES" ]; then
|
||||
clear
|
||||
|
||||
echo "No changes made to macOS settings"
|
||||
else
|
||||
for CHOICE in $CHOICES; do
|
||||
case "$CHOICE" in
|
||||
"1")
|
||||
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
|
||||
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
|
||||
;;
|
||||
"2")
|
||||
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
|
||||
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
|
||||
;;
|
||||
"3")
|
||||
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
|
||||
;;
|
||||
"4")
|
||||
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
|
||||
;;
|
||||
"5")
|
||||
defaults write com.apple.screencapture type -string "png"
|
||||
;;
|
||||
"6")
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
;;
|
||||
"7")
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
;;
|
||||
"8")
|
||||
defaults write com.apple.finder WarnOnEmptyTrash -bool false
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
clear
|
||||
fi
|
167
osx.sh
167
osx.sh
|
@ -1,167 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
# Ask for the admin password upfront
|
||||
sudo -v
|
||||
|
||||
# Keep the sudo session alive
|
||||
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
||||
|
||||
## 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
|
||||
|
||||
# Disable the “Are you sure you want to open this application?” dialog
|
||||
defaults write com.apple.LaunchServices LSQuarantine -bool false
|
||||
|
||||
# Reveal IP address, hostname, OS version, etc. when clicking the clock
|
||||
# in the login window
|
||||
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
|
||||
|
||||
# Check for software updates daily, not just once per week
|
||||
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
|
||||
|
||||
# Set language and text formats
|
||||
defaults write NSGlobalDomain AppleLanguages -array "en"
|
||||
defaults write NSGlobalDomain AppleLocale -string "en_GB@currency=GBP"
|
||||
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
|
||||
defaults write NSGlobalDomain AppleMetricUnits -bool true
|
||||
|
||||
# Set the timezone; see `sudo systemsetup -listtimezones` for other values
|
||||
sudo systemsetup -settimezone "Europe/London" > /dev/null
|
||||
|
||||
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
|
||||
defaults write com.apple.screencapture type -string "png"
|
||||
|
||||
# Finder: show all filename extensions
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
|
||||
# Display full POSIX path as Finder window title
|
||||
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
|
||||
|
||||
# New Finder windows points to home
|
||||
defaults write com.apple.finder NewWindowTarget -string "PfHm"
|
||||
|
||||
# When performing a search, search the current folder by default
|
||||
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
|
||||
|
||||
# Disable the warning when changing a file extension
|
||||
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
|
||||
|
||||
# Avoid creating .DS_Store files on network volumes
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
|
||||
# Disable the warning before emptying the Trash
|
||||
defaults write com.apple.finder WarnOnEmptyTrash -bool false
|
||||
|
||||
# Show the ~/Library folder
|
||||
chflags nohidden ~/Library
|
||||
|
||||
# Show the /Volumes folder
|
||||
sudo chflags nohidden /Volumes
|
||||
|
||||
## Dock and Dashboard
|
||||
# Change minimize/maximize window effect
|
||||
defaults write com.apple.dock mineffect -string "genie"
|
||||
|
||||
# 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
|
||||
|
||||
# Don’t automatically rearrange Spaces based on most recent use
|
||||
defaults write com.apple.dock mru-spaces -bool false
|
||||
|
||||
# Remove the auto-hiding Dock delay
|
||||
defaults write com.apple.dock autohide-delay -float 0
|
||||
# Remove the animation when hiding/showing the Dock
|
||||
defaults write com.apple.dock autohide-time-modifier -float 0
|
||||
|
||||
# Automatically hide and show the Dock
|
||||
defaults write com.apple.dock autohide -bool true
|
||||
|
||||
# Automatically hide the menu bar
|
||||
defaults write NSGlobalDomain _HIHideMenuBar -bool true
|
||||
|
||||
# Show Bluetooth in the menu bar
|
||||
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.bluetooth" -int 0
|
||||
|
||||
# Use a dark menu bar / dock
|
||||
defaults write NSGlobalDomain AppleInterfaceStyle -string "Dark"
|
||||
|
||||
## Safari and Webkit
|
||||
# Privacy: don’t send search queries to Apple
|
||||
defaults write com.apple.Safari UniversalSearchEnabled -bool false
|
||||
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
|
||||
|
||||
# Set Safari’s home page to `about:blank` for faster loading
|
||||
defaults write com.apple.Safari HomePage -string "about:blank"
|
||||
|
||||
# Prevent Safari from opening ‘safe’ files automatically after downloading
|
||||
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
|
||||
|
||||
# Allow hitting the Backspace key to go to the previous page in history
|
||||
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true
|
||||
|
||||
# Enable Safari’s debug menu
|
||||
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
|
||||
|
||||
## Terminal & iTerm2
|
||||
# Only use UTF-8 in Terminal.app
|
||||
defaults write com.apple.terminal StringEncodings -array 4
|
||||
|
||||
# Don’t display the annoying prompt when quitting iTerm
|
||||
defaults write com.googlecode.iterm2 PromptOnQuit -bool false
|
||||
|
||||
## Time Machine
|
||||
# Prevent Time Machine from prompting to use new hard drives as backup volume
|
||||
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
|
||||
|
||||
## Activity Monitor
|
||||
# Show the main window when launching Activity Monitor
|
||||
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
|
||||
|
||||
# Visualize CPU usage in the Activity Monitor Dock icon
|
||||
defaults write com.apple.ActivityMonitor IconType -int 5
|
||||
|
||||
# Show all processes in Activity Monitor
|
||||
defaults write com.apple.ActivityMonitor ShowCategory -int 0
|
||||
|
||||
## Address Book, TextEdit, and Disk Utility
|
||||
# Enable the debug menu in Address Book
|
||||
defaults write com.apple.addressbook ABShowDebugMenu -bool true
|
||||
|
||||
# Use plain text mode for new TextEdit documents
|
||||
defaults write com.apple.TextEdit RichText -int 0
|
||||
# Open and save files as UTF-8 in TextEdit
|
||||
defaults write com.apple.TextEdit PlainTextEncoding -int 4
|
||||
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
|
||||
|
||||
# Enable the debug menu in Disk Utility
|
||||
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
|
||||
defaults write com.apple.DiskUtility advanced-image-options -bool true
|
||||
|
||||
## Mac App Store
|
||||
# Enable the WebKit Developer Tools in the Mac App Store
|
||||
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
|
||||
|
||||
# Enable Debug Menu in the Mac App Store
|
||||
defaults write com.apple.appstore ShowDebugMenu -bool true
|
||||
|
||||
## Photos
|
||||
# Prevent Photos from opening automatically when devices are plugged in
|
||||
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
|
||||
|
||||
## Tweetbot
|
||||
# Bypass the annoyingly slow t.co URL shortener
|
||||
defaults write com.tapbots.TweetbotMac OpenURLsDirectly -bool true
|
||||
|
||||
echo "Updated preferences, some changes may need a restart"
|
Loading…
Add table
Reference in a new issue