#!/bin/bash # ~/.osx — http://mths.be/osx # Ask for the administrator password upfront sudo -v # Keep-alive: update existing `sudo` time stamp until `.osx` has finished while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & ############################################################################### # General UI/UX # ############################################################################### # Save to disk (not to iCloud) by default defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false # Set Help Viewer windows to non-floating mode defaults write com.apple.helpviewer DevMode -bool true # Restart automatically if the computer freezes systemsetup -setrestartfreeze on ############################################################################### # Trackpad, mouse, keyboard, Bluetooth accessories, and input # ############################################################################### # Trackpad: enable tap to click for this user and for the login screen 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 # 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 0 # 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 # Follow the keyboard focus while zoomed in defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true # Disable auto-correct defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false # Disable Ctrl+click context menu for macvim defaults write org.vim.MacVim MMTranslateCtrlClick 0 ############################################################################### # Screen # ############################################################################### # Enable subpixel font rendering on non-Apple LCDs defaults write NSGlobalDomain AppleFontSmoothing -int 2 # Enable HiDPI display modes (requires restart) sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true ############################################################################### # Finder # ############################################################################### # Finder: show status bar defaults write com.apple.finder ShowStatusBar -bool true # Finder: allow text selection in Quick Look defaults write com.apple.finder QLEnableTextSelection -bool true # 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 # 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 # Show the ~/Library folder chflags nohidden ~/Library