-
-
Save jwilling/c284f2288ee00f7646a6 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
#!/bin/sh | |
# Some things taken from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# Ask for the administrator password upfront | |
sudo -v | |
# Keep-alive: update existing `sudo` time stamp until script has finished | |
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & | |
############################################################################### | |
# General UI/UX | |
############################################################################### | |
echo "" | |
echo "Setting your computer name (as done via System Preferences → Sharing)" | |
echo "What would you like it to be?" | |
read COMPUTER_NAME | |
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 | |
echo "" | |
echo "Automatically quit printer app once the print jobs complete" | |
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true | |
echo "" | |
echo "Disabling automatic termination of inactive apps" | |
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true | |
echo "" | |
echo "Saving to disk (not to iCloud) by default" | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
echo "" | |
echo "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 | |
echo "" | |
echo "Never go into computer sleep mode" | |
systemsetup -setcomputersleep Off > /dev/null | |
echo "" | |
echo "Disable smart quotes and smart dashes as they're annoying when typing code" | |
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false | |
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false | |
############################################################################### | |
# Trackpad, mouse, keyboard, Bluetooth accessories, and input | |
############################################################################### | |
echo "" | |
echo "Enabling full keyboard access for all controls (e.g. enable Tab in modal dialogs)" | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
echo "" | |
echo "Disabling press-and-hold for keys in favor of a key repeat" | |
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false | |
echo "" | |
echo "Setting a fast keyboard repeat rate" | |
defaults write NSGlobalDomain KeyRepeat -int 2 | |
echo "" | |
echo "Setting shorter initial key repeat rate" | |
defaults write NSGlobalDomain InitialKeyRepeat -int 12 | |
echo "" | |
echo "Setting trackpad & mouse speed to a reasonable number" | |
defaults write -g com.apple.trackpad.scaling 2 | |
defaults write -g com.apple.mouse.scaling 3 | |
############################################################################### | |
# Screen | |
############################################################################### | |
echo "" | |
echo "Requiring password immediately after sleep or screen saver begins" | |
defaults write com.apple.screensaver askForPassword -int 1 | |
defaults write com.apple.screensaver askForPasswordDelay -int 0 | |
echo "" | |
echo "Enabling subpixel font rendering on non-Apple LCDs" | |
defaults write NSGlobalDomain AppleFontSmoothing -int 2 | |
echo "" | |
echo "Enabling HiDPI display modes (requires restart)" | |
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true | |
############################################################################### | |
# Finder | |
############################################################################### | |
echo "" | |
echo "Showing all filename extensions in Finder by default" | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
echo "" | |
echo "Showing status bar in Finder by default" | |
defaults write com.apple.finder ShowStatusBar -bool true | |
echo "" | |
echo "Allowing text selection in Quick Look/Preview in Finder by default" | |
defaults write com.apple.finder QLEnableTextSelection -bool true | |
echo "" | |
echo "Disabling the warning when changing a file extension" | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
echo "" | |
echo "Use column view in all Finder windows by default" | |
defaults write com.apple.finder FXPreferredViewStyle Clmv | |
echo "" | |
echo "Avoiding the creation of .DS_Store files on network volumes" | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
echo "" | |
echo "Disabling 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 | |
############################################################################### | |
# Dock & Mission Control | |
############################################################################### | |
echo "" | |
echo "Shrink the icon size of the Dock" | |
defaults write com.apple.dock tilesize -int 26 | |
echo "" | |
echo "Speeding up Mission Control animations and grouping windows by application" | |
defaults write com.apple.dock expose-animation-duration -float 0.1 | |
defaults write com.apple.dock "expose-group-by-app" -bool true | |
############################################################################### | |
# WebKit | |
############################################################################### | |
echo "" | |
echo "Enabling 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 | |
echo "" | |
echo "Adding a context menu item for showing the Web Inspector in web views" | |
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true | |
############################################################################### | |
############################################################################### | |
echo "" | |
echo "Setting email addresses to copy as '[email protected]' instead of 'Foo Bar <[email protected]>' in Mail.app" | |
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false | |
############################################################################### | |
# Terminal | |
############################################################################### | |
echo "" | |
echo "Enabling UTF-8 ONLY in Terminal.app and setting the Pro theme by default" | |
defaults write com.apple.terminal StringEncodings -array 4 | |
defaults write com.apple.Terminal "Default Window Settings" -string "Pro" | |
defaults write com.apple.Terminal "Startup Window Settings" -string "Pro" | |
############################################################################### | |
# Time Machine | |
############################################################################### | |
echo "" | |
echo "Preventing Time Machine from prompting to use new hard drives as backup volume" | |
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true | |
############################################################################### | |
# Messages # | |
############################################################################### | |
echo "" | |
echo "Disable smart quotes as it's annoying for messages that contain code" | |
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false | |
echo "" | |
echo "Disable continuous spell checking" | |
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false | |
############################################################################### | |
# Kill affected applications | |
############################################################################### | |
echo "" | |
cecho "Done!" $white | |
echo "" | |
echo "" | |
cecho "###############################################################################" $white | |
echo "" | |
echo "" | |
cecho "Note that some of these changes require a logout/restart to take effect." $white | |
cecho "Killing some open applications in order to take effect." $white | |
echo "" | |
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete | |
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ | |
"Dock" "Finder" "Mail" "Messages" "Safari" "SystemUIServer" \ | |
"Terminal" "Transmission"; do | |
killall "${app}" > /dev/null 2>&1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment