mirror of
https://github.com/jakejarvis/dotfiles.git
synced 2026-05-14 22:14:24 -04:00
Look mom, I finally have a *real* dotfiles repo like the cool kids! 😎
This commit is contained in:
Executable
+323
@@ -0,0 +1,323 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Modified and patched together from a few sources:
|
||||
#
|
||||
# https://mths.be/macos
|
||||
# https://github.com/paulirish/dotfiles/blob/master/.osx
|
||||
# https://github.com/kevinSuttle/macOS-Defaults/blob/master/.macos
|
||||
|
||||
|
||||
COMPUTER_NAME="JJ-MBP15"
|
||||
|
||||
osascript -e 'tell application "System Preferences" to quit'
|
||||
|
||||
# Ask for the administrator password upfront
|
||||
sudo -v
|
||||
|
||||
# Keep-alive: update existing `sudo` time stamp until this script has finished
|
||||
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
||||
|
||||
|
||||
###############################################################################
|
||||
# General UI/UX #
|
||||
###############################################################################
|
||||
|
||||
# Set computer name (as done via System Preferences → Sharing)
|
||||
sudo scutil --set ComputerName "$COMPUTER_NAME"
|
||||
sudo scutil --set HostName "$COMPUTER_NAME"
|
||||
sudo scutil --set LocalHostName "$COMPUTER_NAME"
|
||||
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$COMPUTER_NAME"
|
||||
|
||||
# Set language and text formats
|
||||
defaults write NSGlobalDomain AppleLanguages -array "en"
|
||||
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD"
|
||||
defaults write NSGlobalDomain AppleMeasurementUnits -string "Inches"
|
||||
defaults write NSGlobalDomain AppleMetricUnits -bool false
|
||||
|
||||
# Set the timezone (see `sudo systemsetup -listtimezones` for other values)
|
||||
sudo systemsetup -settimezone "America/New_York" > /dev/null
|
||||
|
||||
# Set standby delay to 24 hours (default is 1 hour)
|
||||
sudo pmset -a standbydelay 86400
|
||||
|
||||
# Disable Sudden Motion Sensor
|
||||
sudo pmset -a sms 0
|
||||
|
||||
# Disable audio feedback when volume is changed
|
||||
defaults write com.apple.sound.beep.feedback -bool false
|
||||
|
||||
# Disable the sound effects on boot
|
||||
sudo nvram SystemAudioVolume=" "
|
||||
|
||||
# Menu bar: show battery percentage
|
||||
defaults write com.apple.menuextra.battery ShowPercent YES
|
||||
|
||||
# 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
|
||||
|
||||
# Save to disk (not to iCloud) by default
|
||||
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
|
||||
|
||||
# Remove duplicates in the “Open With” menu (also see `lscleanup` alias)
|
||||
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
|
||||
|
||||
# Disable Resume system-wide
|
||||
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
|
||||
|
||||
# Restart automatically if the computer freezes
|
||||
sudo systemsetup -setrestartfreeze on
|
||||
|
||||
###############################################################################
|
||||
# Keyboard & Input #
|
||||
###############################################################################
|
||||
|
||||
# Disable smart quotes and dashes as they’re annoying when typing code
|
||||
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
|
||||
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
|
||||
|
||||
# Enable full keyboard access for all controls
|
||||
# (e.g. enable Tab in modal dialogs)
|
||||
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
|
||||
|
||||
# Disable press-and-hold for keys in favor of key repeat
|
||||
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
|
||||
|
||||
# Set a blazingly fast keyboard repeat rate
|
||||
defaults write NSGlobalDomain KeyRepeat -int 1
|
||||
defaults write NSGlobalDomain InitialKeyRepeat -int 15
|
||||
|
||||
# Automatically illuminate built-in MacBook keyboard in low light
|
||||
defaults write com.apple.BezelServices kDim -bool true
|
||||
|
||||
# Turn off keyboard illumination when computer is not used for 5 minutes
|
||||
defaults write com.apple.BezelServices kDimTime -int 300
|
||||
|
||||
# Disable auto-correct
|
||||
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
|
||||
|
||||
###############################################################################
|
||||
# Trackpad, mouse, Bluetooth accessories #
|
||||
###############################################################################
|
||||
|
||||
# Trackpad: enable tap to click for this user and for the login screen
|
||||
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
|
||||
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
|
||||
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
|
||||
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
|
||||
|
||||
# Increase sound quality for Bluetooth headphones/headsets
|
||||
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
|
||||
|
||||
# Use scroll gesture with the Ctrl (^) modifier key to zoom
|
||||
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
|
||||
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
|
||||
|
||||
###############################################################################
|
||||
# Screen #
|
||||
###############################################################################
|
||||
|
||||
# Require password immediately after sleep or screen saver begins
|
||||
defaults write com.apple.screensaver askForPassword -int 1
|
||||
defaults write com.apple.screensaver askForPasswordDelay -int 0
|
||||
|
||||
# Save screenshots to the desktop
|
||||
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
|
||||
|
||||
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
|
||||
defaults write com.apple.screencapture type -string "png"
|
||||
|
||||
# Disable shadow in screenshots
|
||||
defaults write com.apple.screencapture disable-shadow -bool true
|
||||
|
||||
###############################################################################
|
||||
# Finder #
|
||||
###############################################################################
|
||||
|
||||
# Finder: show all filename extensions
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
|
||||
# Finder: show status bar
|
||||
defaults write com.apple.finder ShowStatusBar -bool true
|
||||
|
||||
# Finder: show path bar
|
||||
defaults write com.apple.finder ShowPathbar -bool true
|
||||
|
||||
# Finder: allow text selection in Quick Look
|
||||
defaults write com.apple.finder QLEnableTextSelection -bool true
|
||||
|
||||
# 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 or USB volumes
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
|
||||
|
||||
# Use AirDrop over every interface.
|
||||
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -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
|
||||
|
||||
# Always open everything in Finder's list view.
|
||||
# Use list view in all Finder windows by default
|
||||
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
|
||||
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
|
||||
|
||||
# Show the ~/Library folder
|
||||
chflags nohidden ~/Library
|
||||
|
||||
# Expand the following File Info panes:
|
||||
# “General”, “Open with”, and “Sharing & Permissions”
|
||||
defaults write com.apple.finder FXInfoPanesExpanded -dict \
|
||||
General -bool true \
|
||||
OpenWith -bool true \
|
||||
Privileges -bool true
|
||||
|
||||
###############################################################################
|
||||
# Dock #
|
||||
###############################################################################
|
||||
|
||||
# Show indicator lights for open applications in the Dock
|
||||
defaults write com.apple.dock show-process-indicators -bool true
|
||||
|
||||
# Automatically hide and show the Dock
|
||||
defaults write com.apple.dock autohide -bool true
|
||||
|
||||
# Group windows by application in Mission Control
|
||||
defaults write com.apple.dock expose-group-by-app -bool true
|
||||
|
||||
# Disable hot corners
|
||||
defaults write com.apple.dock wvous-tl-corner -int 0
|
||||
defaults write com.apple.dock wvous-tr-corner -int 0
|
||||
defaults write com.apple.dock wvous-bl-corner -int 0
|
||||
defaults write com.apple.dock wvous-br-corner -int 0
|
||||
|
||||
# Don't show recently used applications in the Dock
|
||||
defaults write com.Apple.Dock show-recents -bool false
|
||||
|
||||
###############################################################################
|
||||
# Spotlight #
|
||||
###############################################################################
|
||||
|
||||
# Disable Spotlight indexing for any volume that gets mounted and has not yet
|
||||
# been indexed before.
|
||||
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
|
||||
sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
|
||||
|
||||
# Change indexing order and disable some file types
|
||||
defaults write com.apple.spotlight orderedItems -array \
|
||||
'{"enabled" = 1;"name" = "APPLICATIONS";}' \
|
||||
'{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
|
||||
'{"enabled" = 1;"name" = "DIRECTORIES";}' \
|
||||
'{"enabled" = 1;"name" = "CONTACT";}' \
|
||||
'{"enabled" = 1;"name" = "DOCUMENTS";}' \
|
||||
'{"enabled" = 1;"name" = "PDF";}' \
|
||||
'{"enabled" = 0;"name" = "FONTS";}' \
|
||||
'{"enabled" = 0;"name" = "MESSAGES";}' \
|
||||
'{"enabled" = 0;"name" = "EVENT_TODO";}' \
|
||||
'{"enabled" = 0;"name" = "IMAGES";}' \
|
||||
'{"enabled" = 0;"name" = "BOOKMARKS";}' \
|
||||
'{"enabled" = 0;"name" = "MUSIC";}' \
|
||||
'{"enabled" = 0;"name" = "MOVIES";}' \
|
||||
'{"enabled" = 0;"name" = "PRESENTATIONS";}' \
|
||||
'{"enabled" = 0;"name" = "SPREADSHEETS";}' \
|
||||
'{"enabled" = 0;"name" = "SOURCE";}'
|
||||
|
||||
# Load new settings before rebuilding the index
|
||||
killall mds > /dev/null 2>&1
|
||||
|
||||
# Make sure indexing is enabled for the main volume
|
||||
sudo mdutil -i on / > /dev/null
|
||||
|
||||
# Rebuild the index from scratch
|
||||
sudo mdutil -E / > /dev/null
|
||||
|
||||
###############################################################################
|
||||
# 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
|
||||
|
||||
# Sort Activity Monitor results by CPU usage
|
||||
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
|
||||
defaults write com.apple.ActivityMonitor SortDirection -int 0
|
||||
|
||||
###############################################################################
|
||||
# Photos #
|
||||
###############################################################################
|
||||
|
||||
# Prevent Photos from opening automatically when devices are plugged in
|
||||
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
|
||||
|
||||
###############################################################################
|
||||
# Messages #
|
||||
###############################################################################
|
||||
|
||||
# Disable automatic emoji substitution (i.e. use plain text smileys)
|
||||
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false
|
||||
|
||||
# Disable smart quotes as it’s annoying for messages that contain code
|
||||
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
|
||||
|
||||
# Disable continuous spell checking
|
||||
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false
|
||||
|
||||
###############################################################################
|
||||
# TextEdit #
|
||||
###############################################################################
|
||||
|
||||
# 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
|
||||
|
||||
###############################################################################
|
||||
# GPGMail 2 #
|
||||
###############################################################################
|
||||
|
||||
# Disable signing emails by default
|
||||
defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false
|
||||
|
||||
###############################################################################
|
||||
# Software Updates #
|
||||
###############################################################################
|
||||
|
||||
# Enable the automatic update check
|
||||
defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true
|
||||
|
||||
# Check for software updates daily, not just once per week
|
||||
defaults write com.apple.SoftwareUpdate ScheduleFrequency -bool true
|
||||
|
||||
# Download newly available updates in background
|
||||
defaults write com.apple.SoftwareUpdate AutomaticDownload -bool true
|
||||
|
||||
# Install System data files & security updates
|
||||
defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -bool true
|
||||
|
||||
# Turn off app auto-update
|
||||
defaults write com.apple.commerce AutoUpdate -bool false
|
||||
|
||||
###############################################################################
|
||||
# Finished! #
|
||||
###############################################################################
|
||||
|
||||
echo "All done! Some of these changes require a logout/restart to take effect."
|
||||
Reference in New Issue
Block a user