Last active
January 2, 2020 18:48
-
-
Save jblyberg/44f275de6fc1904b9898095cc9063159 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# ~/.macos — https://mths.be/macos | |
# Close any open System Preferences panes, to prevent them from overriding | |
# settings we’re about to change | |
osascript -e 'tell application "System Preferences" to quit' | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
############################################################################### | |
# General UI/UX # | |
############################################################################### | |
# Set standby delay to 24 hours (default is 1 hour) | |
sudo pmset -a standbydelay 86400 | |
# Disable the over-the-top focus ring animation | |
defaults write NSGlobalDomain NSUseAnimatedFocusRing -bool false | |
# Increase window resize speed for Cocoa applications | |
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 | |
# Save to disk (not to iCloud) by default | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
# 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 | |
# 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 | |
# Display ASCII control characters using caret notation in standard text views | |
# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` | |
defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true | |
# Disable automatic termination of inactive apps | |
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true | |
# Never go into computer sleep mode | |
sudo systemsetup -setcomputersleep Off > /dev/null | |
# Disable Notification Center and remove the menu bar icon | |
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null | |
# Disable automatic capitalization as it’s annoying when typing code | |
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false | |
# Disable smart dashes as they’re annoying when typing code | |
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false | |
# Disable automatic period substitution as it’s annoying when typing code | |
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false | |
# Disable smart quotes as they’re annoying when typing code | |
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false | |
# Disable auto-correct | |
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false | |
############################################################################### | |
# SSD-specific tweaks # | |
############################################################################### | |
# Disable hibernation (speeds up entering sleep mode) | |
sudo pmset -a hibernatemode 0 | |
############################################################################### | |
# Trackpad, mouse, keyboard, Bluetooth accessories, and input # | |
############################################################################### | |
# Increase sound quality for Bluetooth headphones/headsets | |
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 | |
# 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 10 | |
############################################################################### | |
# Screen # | |
############################################################################### | |
# Save screenshots to the desktop | |
defaults write com.apple.screencapture location -string "${HOME}/Desktop/Screenshots" | |
# 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 | |
# Enable subpixel font rendering on non-Apple LCDs | |
# Reference: https://github.com/kevinSuttle/macOS-Defaults/issues/17#issuecomment-266633501 | |
defaults write NSGlobalDomain AppleFontSmoothing -int 1 | |
# Enable HiDPI display modes (requires restart) | |
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true | |
############################################################################### | |
# Finder # | |
############################################################################### | |
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons | |
defaults write com.apple.finder QuitMenuItem -bool true | |
# Finder: disable window animations and Get Info animations | |
defaults write com.apple.finder DisableAllAnimations -bool true | |
# Set Desktop as the default location for new Finder windows | |
# For other paths, use `PfLo` and `file:///full/path/here/` | |
defaults write com.apple.finder NewWindowTarget -string "PfDe" | |
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" | |
# Show icons for hard drives, servers, and removable media on the desktop | |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true | |
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true | |
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true | |
defaults write com.apple.finder ShowRemovableMediaOnDesktop -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 | |
# 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" | |
# Disable the warning when changing a file extension | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Enable spring loading for directories | |
defaults write NSGlobalDomain com.apple.springing.enabled -bool true | |
# Remove the spring loading delay for directories | |
defaults write NSGlobalDomain com.apple.springing.delay -float 0 | |
# 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 | |
# Disable disk image verification | |
defaults write com.apple.frameworks.diskimages skip-verify -bool true | |
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true | |
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true | |
# 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" | |
# 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 | |
############################################################################### | |
# 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment