-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
297 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,297 @@ | ||
#!/usr/bin/env bash | ||
|
||
# ~/.osx — http://mths.be/osx | ||
|
||
# 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 # | ||
############################################################################### | ||
|
||
# Only show scrollbars when scrolling | ||
defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling" | ||
|
||
# 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 | ||
|
||
# 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 | ||
|
||
# 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 | ||
|
||
############################################################################### | ||
# 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 | ||
|
||
# Enable secondary click on Magic Mouse | ||
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode -string "TwoButton" | ||
|
||
# Increase sound quality for Bluetooth headphones/headsets | ||
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 | ||
|
||
# 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 | ||
|
||
# Set language and text formats | ||
defaults write NSGlobalDomain AppleLanguages -array "en" "es" | ||
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" | ||
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" | ||
defaults write NSGlobalDomain AppleMetricUnits -bool true | ||
|
||
############################################################################### | ||
# Screen # | ||
############################################################################### | ||
|
||
# Require password 5 minutes after sleep or screen saver begins | ||
defaults write com.apple.screensaver askForPassword -int 1 | ||
defaults write com.apple.screensaver askForPasswordDelay -int 0 | ||
|
||
############################################################################### | ||
# Finder # | ||
############################################################################### | ||
|
||
# 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 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 | ||
|
||
# Keep folders on top when sorting by name | ||
defaults write com.apple.finder _FXSortFoldersFirst -bool true | ||
|
||
# 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 column view in all Finder windows by default | ||
defaults write com.apple.Finder FXPreferredViewStyle -string "clmv" | ||
|
||
# Show the ~/Library folder | ||
chflags nohidden ~/Library | ||
|
||
############################################################################### | ||
# Dock, Dashboard, and hot corners # | ||
############################################################################### | ||
|
||
# Set the icon size of Dock items to 32 pixels | ||
defaults write com.apple.dock tilesize -int 32 | ||
|
||
# Change minimize/maximize window effect | ||
defaults write com.apple.dock mineffect -string "scale" | ||
|
||
# Set magnification on | ||
defaults write com.apple.dock magnification -bool true | ||
|
||
# Set the icon magnification size to 56.8287 pixels | ||
defaults write com.apple.dock largesize -float 56.8287 | ||
|
||
# Speed up Mission Control animations | ||
defaults write com.apple.dock expose-animation-duration -float 0.1 | ||
|
||
# Don’t automatically rearrange Spaces based on most recent use | ||
defaults write com.apple.dock mru-spaces -bool false | ||
|
||
# Automatically hide and show the Dock | ||
defaults write com.apple.dock autohide -bool true | ||
|
||
# Reset Launchpad, but keep the desktop wallpaper intact | ||
find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete | ||
|
||
############################################################################### | ||
# Safari & 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 | ||
|
||
# Press Tab to highlight each item on a web page | ||
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true | ||
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true | ||
|
||
# Show the full URL in the address bar (note: this still hides the scheme) | ||
defaults write com.apple.Safari ShowFullURLInSmartSearchField -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 | ||
|
||
# Hide Safari’s bookmarks bar by default | ||
defaults write com.apple.Safari ShowFavoritesBar -bool false | ||
|
||
# Hide Safari’s sidebar in Top Sites | ||
defaults write com.apple.Safari ShowSidebarInTopSites -bool false | ||
|
||
# Disable Safari’s thumbnail cache for History and Top Sites | ||
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 | ||
|
||
# Enable Safari’s debug menu | ||
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true | ||
|
||
# Enable 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 | ||
|
||
# Add a context menu item for showing the Web Inspector in web views | ||
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true | ||
|
||
# Disable AutoFill | ||
defaults write com.apple.Safari AutoFillFromAddressBook -bool false | ||
defaults write com.apple.Safari AutoFillPasswords -bool false | ||
defaults write com.apple.Safari AutoFillCreditCardData -bool false | ||
defaults write com.apple.Safari AutoFillMiscellaneousForms -bool false | ||
|
||
# Warn about fraudulent websites | ||
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true | ||
|
||
# Enable “Do Not Track” | ||
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true | ||
|
||
# Update extensions automatically | ||
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true | ||
|
||
############################################################################### | ||
# Mail # | ||
############################################################################### | ||
|
||
# Disable inline attachments (just show the icons) | ||
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true | ||
|
||
############################################################################### | ||
# Terminal & iTerm 2 # | ||
############################################################################### | ||
|
||
# Enable Secure Keyboard Entry in Terminal.app | ||
# See: https://security.stackexchange.com/a/47786/8918 | ||
defaults write com.apple.terminal SecureKeyboardEntry -bool true | ||
|
||
# Disable the annoying line marks | ||
defaults write com.apple.Terminal ShowLineMarks -int 0 | ||
|
||
############################################################################### | ||
# Time Machine # | ||
############################################################################### | ||
|
||
# Prevent Time Machine from prompting to use new hard drives as backup volume | ||
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true | ||
|
||
# Disable local Time Machine backups | ||
hash tmutil &> /dev/null && sudo tmutil disablelocal | ||
|
||
############################################################################### | ||
# Activity Monitor # | ||
############################################################################### | ||
|
||
# Visualize Network usage in the Activity Monitor Dock icon | ||
defaults write com.apple.ActivityMonitor IconType -int 2 | ||
|
||
############################################################################### | ||
# Photos # | ||
############################################################################### | ||
|
||
# Prevent Photos from opening automatically when devices are plugged in | ||
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true | ||
|
||
############################################################################### | ||
# Transmission.app # | ||
############################################################################### | ||
|
||
# Don’t prompt for confirmation before downloading | ||
defaults write org.m0k.transmission DownloadAsk -bool false | ||
defaults write org.m0k.transmission MagnetOpenAsk -bool false | ||
|
||
# Don’t prompt for confirmation before removing non-downloading active transfers | ||
defaults write org.m0k.transmission CheckRemoveDownloading -bool true | ||
|
||
# Trash original torrent files | ||
defaults write org.m0k.transmission DeleteOriginalTorrent -bool true | ||
|
||
# Hide the donate message | ||
defaults write org.m0k.transmission WarningDonate -bool false | ||
|
||
# Hide the legal disclaimer | ||
defaults write org.m0k.transmission WarningLegal -bool false | ||
|
||
# IP block list. | ||
# Source: https://giuliomac.wordpress.com/2014/02/19/best-blocklist-for-transmission/ | ||
defaults write org.m0k.transmission BlocklistNew -bool true | ||
defaults write org.m0k.transmission BlocklistURL -string "http://john.bitsurge.net/public/biglist.p2p.gz" | ||
defaults write org.m0k.transmission BlocklistAutoUpdate -bool true | ||
|
||
# Randomize port on launch | ||
defaults write org.m0k.transmission RandomPort -bool true | ||
|
||
############################################################################### | ||
# Firewall | ||
############################################################################### | ||
|
||
# Enable per application firewall | ||
defaults write /Library/Preferences/com.apple.alf globalstate -int 1 | ||
|
||
############################################################################### | ||
# Kill affected applications # | ||
############################################################################### | ||
|
||
for app in "Activity Monitor" \ | ||
"Dashboard" \ | ||
"Dock" \ | ||
"Finder" \ | ||
"Photos" \ | ||
"Safari" \ | ||
"SystemUIServer" \ | ||
"Mail" \ | ||
"Terminal" \ | ||
"Transmission"; do | ||
killall "$app" > /dev/null 2>&1 | ||
done | ||
echo "Done. Note that some of these changes require a logout/restart to take effect." |