Skip to content

Instantly share code, notes, and snippets.

@wbs75
Last active January 12, 2017 06:29
Show Gist options
  • Select an option

  • Save wbs75/5655485 to your computer and use it in GitHub Desktop.

Select an option

Save wbs75/5655485 to your computer and use it in GitHub Desktop.
OSX 10.8 defaults
#!/bin/bash
# ~/.osx — https://github.com/wbs75/dotfiles/edit/master/.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 #
###############################################################################
###############################################################################
# Disable Mountain Lion's Gatekeeper #
###############################################################################
sudo spctl --master-disable
###############################################################################
# Set computer name (as done via System Preferences → Sharing)
###############################################################################
sudo scutil --set ComputerName "MacPro"
sudo scutil --set HostName "server.macpro"
sudo scutil --set LocalHostName "MacPro"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "server.macpro"
###############################################################################
# Dock & hot corners #
###############################################################################
# Enable2Ddock
defaults write com.apple.dock no-glass -bool true && killall Dock
# Where on the side of the screen the Dock resides.
defaults write com.apple.dock pinning -string "middle" true && killall Dock
# Defines the animation which is used to show windows being minimized into the Dock.
defaults write com.apple.dock mineffect -string "suck" true && killall Dock
# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true && killall Dock
# Make list view stacks work like grid view stacks.
defaults write com.apple.dock use-new-list-stack -bool true && killall Dock
# Enable highlight hover effect for the grid view of a stack (Dock)
defaults write com.apple.dock mouse-over-hilte-stack -bool true && killall Dock
# Program alerts will not be sent to the Dock causing it to bounce. Example: receiving an instant message when the application is in the background.
defaults write com.apple.dock no-bouncing -bool true && killall Dock
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true && killall Dock
# Don’t animate opening applications from the Dock
defaults write com.apple.dock launchanim -bool false && killall Dock
###############################################################################
# MenuBar #
###############################################################################
# Disable menu bar transparency
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# Show remaining battery time; hide percentage
defaults write com.apple.menuextra.battery ShowPercent -string "NO"
defaults write com.apple.menuextra.battery ShowTime -string "YES"
###############################################################################
# Finder #
###############################################################################
# Windows which were open prior to logging out are re-opened after logging in.
defaults write com.apple.finder RestoreWindowState -bool true && killall Finder
# Allow Rubberband scrolling
defaults write NSGlobalDomain NSScrollViewRubberbanding -bool true && killall Finder
# The location and style of scrollbar arrows. Applications often need to be relaunched to see the change.
defaults write NSGlobalDomain AppleScrollBarVariant -string "DoubleBoth" true && killall Finder
# Smooth Scroll
defaults write NSGlobalDomain NSScrollAnimationEnabled -bool true && killall Finder
# Reveals hidden files that begin with a period or are flagged specially as hidden.
defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder
# Prefered View Style
defaults write com.apple.finder FXPreferredViewStyle -string "clmv" true && killall Finder
# Adds the ability to highlight and select text from QuickLook previews.
defaults write com.apple.finder QLEnableTextSelection -bool true && killall Finder
# Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false && killall Finder
# Disable Resume system-wide
defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false && killall Finder
# Always show scrollbars
defaults write NSGlobalDomain AppleShowScrollBars -string "Always" && killall Finder
# Allow quitting Finder via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true && killall Finder
# Show all filename extensions in Finder
defaults write NSGlobalDomain AppleShowAllExtensions -bool true && killall Finder
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true && killall Finder
# Automatically open a new Finder window when a volume is mounted
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true && killall Finder
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true && killall Finder
# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true && killall Finder
# Increase window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 && killall Finder
# 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
killall Finder
###############################################################################
# Remote #
###############################################################################
# Admin Console Allows Remote Control
defaults delete /Library/Preferences/com.apple.RemoteManagement AdminConsoleAllowsRemoteControl
# Prevents system keys like command-tab from being sent
defaults write com.apple.RemoteDesktop DoNotSendSystemKeys -bool true
# Show the Debug menu Remote Desktop
defaults write com.apple.remotedesktop IncludeDebugMenu -bool true
# Define user name display behavior.
defaults write com.apple.remotedesktop showShortUserName -bool true
# Prevent protection when attempting to remotely control this computer.
defaults write com.apple.ScreenSharing skipLocalAddressCheck -bool true
# Disables system-level key combos like command-option-esc (Force Quit), command-tab (App switcher) to be used on the remote machine.
defaults write com.apple.ScreenSharing DoNotSendSystemKeys -bool true
###############################################################################
# SystemPref #
###############################################################################
# Warning: This feature may be unstable. Requires a restart. Enables Quartz 2D extreme functionality, which uses the graphics card to render graphics and text.
defaults write /Library/Preferences/com.apple.windowserver Quartz2DExtremeEnabled -bool true
# Prevent Dashboard from loading
defaults write com.apple.dashboard mcx-disabled -bool true
# Disable Mission Control
defaults write com.apple.Dock mcx-expose-disabled -bool true
# Disable Secure Virtual Memory
defaults write /Library/Preferences/com.apple.virtualMemory DisableEncryptedSwap -bool true
# isables the 'downloaded from the internet' warning for any new files downloaded.
defaults delete com.apple.LaunchServices LSQuarantine
# Prevent Time Machine from asking about backing up newly connected disks.
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Enable, by default, Automatic Dash Substitution which corrects the type of dashes used as you type.
defaults write NSGlobalDomain WebAutomaticDashSubstitutionEnabled -bool true
# To turn rounded corners off for all windows, amongst other things. Apps must be restarted. Potentially dangerous.
defaults write NSGlobalDomain AppleUseCoreUI -bool true
# Allows basic scripting for Preview.
defaults write com.apple.preview NSAppleScriptEnabled -bool true
# Will check spelling as you type by default, unless the application specifies otherwise.
defaults write NSGlobalDomain CheckSpellingWhileTyping -bool true
# Enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2 true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
# Disable the “Are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
# The format in which screen captures are taken using hot keys (ie. Command-Shift-3, Command-Shift-4, etc.).
defaults write com.apple.screencapture type -string "jpg"
killall SystemUIServer
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# 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
# Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Change the level of interaction available when applications crash.
defaults write com.apple.CrashReporter DialogType -string "developer"
# Disable Automatic Termination
defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true
# Cause Quick Look to print log messages showing its activity, such as which generators it loads and which documents it requests previews and thumbnails for.
defaults write NSGlobalDomain QLEnableLogging -bool true
# Shows file extensions in open and save dialogs.
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Show Expired Certificates
defaults write com.apple.keychainaccess Show\ Expired\ Certificates -bool true
# Makes Keychain Access display *unsigned* ACL entries in italics.
defaults write com.apple.keychainaccess Distinguish\ Legacy\ ACLs -bool true
###############################################################################
# Keyboard & Trackpad #
###############################################################################
# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Enable tap to click (Trackpad)
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# Map bottom right Trackpad corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
###############################################################################
# Diskutil #
###############################################################################
# Show a Debug menu in Disk Utility.
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
# Enables additional disk image options.
defaults write com.apple.DiskUtility advanced-image-options -bool true
# Shows all partitions for a disk in the main list.
defaults write com.apple.DiskUtility DUShowEveryPartition -bool true
# Skip checksum verification for images on remote volumes.
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true
# Skip checksum verification for images on locked voumes
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true
# Allows Disk Images As RAIDs
defaults write com.apple.DiskUtility DUAllowsDiskImagesAsRAIDs -bool true
# Disk Skip Verify
defaults write com.apple.DiskUtility DURestoreCanSkipVerify -bool true
# Debug All Message Level
defaults write com.apple.DiskUtility DUDebugMessageLevel -int 4
# Show Details In First Aid
defaults write com.apple.DiskUtility DUShowDetailsInFirstAid -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
# Automatically open a Finder window for read-only disk images.
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
# Automatically open a Finder window for read-write disk images.
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
###############################################################################
# Terminal #
###############################################################################
# Only use UTF-8 in Terminal.app
defaults write com.apple.terminal StringEncodings -array 4
# Focus Follows Mouse
defaults write com.apple.terminal FocusFollowsMouse -bool true
###############################################################################
# Safari & WebKit #
###############################################################################
# Requires Safari 5.0.1 or later. Feature that is intended to increase the speed at which pages load. DNS (Domain Name System) prefetching kicks in when you load a webpage that contains links to other pages. As soon as the initial page is loaded, Safari 5.0.1 (or later) begins resolving the listed links’ domain names to their IP addresses. Prefetching can occasionally result in “slow performance, partially-loaded pages, or webpage ‘cannot be found’ messages.”
defaults write com.apple.safari WebKitDNSPrefetchingEnabled -bool true
# Disable Data Dectors
defaults write com.apple.Safari WebKitUsesEncodingDetector -bool false
# Disable Safari’s thumbnail cache for History and Top Sites
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# Google Suggestion
defaults write com.apple.safari DebugSafari4IncludeGoogleSuggest -bool true
# Automatically spell check web forms.
defaults write com.apple.safari WebContinuousSpellCheckingEnabled -bool true
# Automatically grammar check web forms.
defaults write com.apple.safari WebGrammarCheckingEnabled -bool true
# Enable Safari’s debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# Include page background colors and images when printing.
defaults write com.apple.safari WebKitShouldPrintBackgroundsPreferenceKey -bool true
# Remove useless icons from Safari’s bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# Remove useless icons from Safari’s bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# Hitting the backspace key on the keyboard will have the same effect as clicking the "Back" button in Safari.
defaults write com.apple.safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true
###############################################################################
# iTunes #
###############################################################################
# Disable the Ping sidebar in iTunes
defaults write com.apple.iTunes disablePingSidebar -bool true
# Disable all the other Ping stuff in iTunes
defaults write com.apple.iTunes disablePing -bool true
# Hides the dropdown Ping menu that appears next to songs.
defaults write com.apple.iTunes hide-ping-dropdown -bool true
# Disable the Genius sidebar
defaults write com.apple.itunes disableGeniusSidebar -bool true
###############################################################################
# Quicktime #
###############################################################################
# Allow Multiple Simultaneous Recordings
defaults write com.apple.QuickTimePlayerX MGAllowMultipleSimultaneousRecordings -bool true
# Always Show TitleBar Controller
defaults write com.apple.QuickTimePlayerX MGUIVisibilityNeverAutohide -bool true
# No Rounded Corners
defaults write com.apple.QuickTimePlayerX MGCinematicWindowDebugForceNoRoundedCorners -bool true
###############################################################################
# Mail #
###############################################################################
# Disable send and reply animations in Mail.app
defaults write com.apple.Mail DisableReplyAnimations -bool true
defaults write com.apple.Mail DisableSendAnimations -bool true
# Copy email addresses as `[email protected]` instead of `Foo Bar <[email protected]>` in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\\U21a9"
###############################################################################
# iMessage #
###############################################################################
# Automatically go away after the specified time period.
defaults write com.apple.ichat AutoAway -bool true
# Disable iChat Data Detectors which help locate e-mails, dates, and other data tidbits.
defaults write com.apple.ichat EnableDataDetectors -bool false
###############################################################################
# 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
###############################################################################
# Parallels #
###############################################################################
# Disable Advertisment
defaults write com.parallels.Parallels\ Desktop ProductPromo.ForcePromoOff -bool true
###########################
# Misc #
###########################
# / Reset Launchpad
[ -e ~/Library/Application\ Support/Dock/*.db ] && rm ~/Library/Application\ Support/Dock/*.db
# Show the ~/Library folder
chflags nohidden ~/Library
# Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo)
# Commented out, as this is known to cause problems when saving files in Adobe Illustrator CS5 :(
echo "0x08000100:0" > ~/.CFUserTextEncoding
# Allow installing user scripts via GitHub or Userscripts.org
defaults write com.google.Chrome ExtensionInstallSources -array "https://*.github.com/*" "http://userscripts.org/*"
defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://*.github.com/*" "http://userscripts.org/*"
###############################################################################
# Kill affected applications #
###############################################################################
for app in "Address Book" "Calendar" "Contacts" "Dashboard" "Dock" "Finder" \
"Mail" "Safari" "SizeUp" "SystemUIServer" \
"Twitter" "iCal" "iTunes"; do
killall "$app" > /dev/null 2>&1
done
echo "Done. Note that some of these changes require a logout/restart to take effect."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment