|
#!/usr/bin/env 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 |
|
# ---------------------------------------------------------------------- |
|
|
|
# Set computer name (as done via System Preferences → Sharing) |
|
sudo scutil --set ComputerName "benjaminbasa" |
|
sudo scutil --set HostName "benjaminbasa" |
|
sudo scutil --set LocalHostName "benjaminbasa" |
|
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "benjaminbasa" |
|
|
|
# Menu bar: disable transparency |
|
defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool true |
|
|
|
# Menu bar: show remaining battery time (on pre-10.8); hide percentage |
|
defaults write com.apple.menuextra.battery ShowPercent -string "YES" |
|
defaults write com.apple.menuextra.battery ShowTime -string "YES" |
|
|
|
# Set sidebar icon size to medium |
|
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1 |
|
|
|
# Scrollbars |
|
# Possible values: `WhenScrolling`, `Automatic` and `Always` |
|
defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling" |
|
|
|
# Expand save panel by default |
|
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true |
|
|
|
# Save to disk (not to iCloud) by default |
|
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false |
|
|
|
# Disable the “Are you sure you want to open this application?” dialog |
|
defaults write com.apple.LaunchServices LSQuarantine -bool false |
|
|
|
# Disable the crash reporter |
|
defaults write com.apple.CrashReporter DialogType -string "none" |
|
|
|
# Restart automatically if the computer freezes |
|
systemsetup -setrestartfreeze on |
|
|
|
# Check for software updates daily, not just once per week |
|
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 |
|
|
|
|
|
|
|
# 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 |
|
|
|
# Trackpad: map bottom right corner to right-click |
|
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 |
|
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true |
|
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 |
|
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true |
|
|
|
# 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 |
|
|
|
# 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 |
|
|
|
# Automatically illuminate built-in MacBook keyboard in low light |
|
defaults write com.apple.BezelServices kDim -bool true |
|
# Turn off keyboard illumination when computer is not used for 5 minutes |
|
defaults write com.apple.BezelServices kDimTime -int 300 |
|
|
|
# Set language and text formats |
|
# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with |
|
# `Inches`, `en_GB` with `en_US`, and `true` with `false`. |
|
defaults write NSGlobalDomain AppleLanguages -array "en" |
|
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=PHP" |
|
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" |
|
defaults write NSGlobalDomain AppleMetricUnits -bool true |
|
|
|
# Set the timezone; see `systemsetup -listtimezones` for other values |
|
systemsetup -settimezone "Asia/Manila" > /dev/null |
|
|
|
# Disable auto-correct |
|
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false |
|
|
|
|
|
|
|
# Screen |
|
# ---------------------------------------------------------------------- |
|
|
|
# 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 |
|
|
|
# Save screenshots to the desktop |
|
defaults write com.apple.screencapture location -string "$HOME/Desktop" |
|
|
|
# Disable shadow in screenshots |
|
defaults write com.apple.screencapture disable-shadow -bool true |
|
|
|
# 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 |
|
# I'll be getting a 15" Macbook Pro with Retina Display.. so excitedddd! |
|
|
|
|
|
|
|
# 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 false |
|
defaults write com.apple.finder ShowRemovableMediaOnDesktop -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 |
|
|
|
# Enable spring loading for directories |
|
defaults write NSGlobalDomain com.apple.springing.enabled -bool true |
|
|
|
# Avoid creating .DS_Store files on network volumes |
|
defaults write com.apple.desktopservices DSDontWriteNetworkStores -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 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 item info near icons on the desktop and in other icon views |
|
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist |
|
|
|
# Show item info to the right of the icons on the desktop |
|
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist |
|
|
|
# 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 |
|
|
|
# Increase grid spacing for icons on the desktop and in other icon views |
|
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist |
|
|
|
# Set the size of icons on the desktop and in other icon views |
|
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 32" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 48" ~/Library/Preferences/com.apple.finder.plist |
|
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 48" ~/Library/Preferences/com.apple.finder.plist |
|
|
|
# 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 |
|
|
|
# Empty Trash securely by default |
|
defaults write com.apple.finder EmptyTrashSecurely -bool false |
|
|
|
# Enable AirDrop over Ethernet and on unsupported Macs running Lion |
|
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true |
|
|
|
# Enable the MacBook Air SuperDrive on any Mac |
|
sudo nvram boot-args="mbasd=1" |
|
|
|
# Show the ~/Library folder |
|
chflags nohidden ~/Library |
|
|
|
# Remove Dropbox’s green checkmark icons in Finder |
|
file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns |
|
[ -e "$file" ] && mv -f "$file" "$file.bak" |
|
|
|
# Add iOS Simulator to Launchpad |
|
ln -s /Applications/Xcode.app/Contents/Applications/iPhone\ Simulator.app /Applications/iOS\ Simulator.app |
|
|
|
|
|
# Dock, Dashboard, and hot corners |
|
# ---------------------------------------------------------------------- |
|
|
|
# Set the icon size of Dock items to 28 pixels |
|
defaults write com.apple.dock tilesize -int 28 |
|
|
|
# Enable spring loading for all Dock items |
|
defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true |
|
|
|
# Show indicator lights for open applications in the Dock |
|
defaults write com.apple.dock show-process-indicators -bool true |
|
|
|
# Wipe all (default) app icons from the Dock |
|
# This is only really useful when setting up a new Mac, or if you don’t use |
|
# the Dock to launch apps. |
|
defaults write com.apple.dock persistent-apps -array |
|
|
|
# Speed up Mission Control animations |
|
defaults write com.apple.dock expose-animation-duration -float 0.1 |
|
|
|
# Make Dock icons of hidden applications translucent |
|
defaults write com.apple.dock showhidden -bool true |
|
|
|
# Reset Launchpad |
|
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete |
|
|
|
# Add a spacer to the left side of the Dock (where the applications are) |
|
# defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' |
|
|
|
# Add a spacer to the right side of the Dock (where the Trash is) |
|
# defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' |
|
|
|
|
|
|
|
# Safari & WebKit |
|
# ---------------------------------------------------------------------- |
|
|
|
# Set Safari’s home page to `about:blank` for faster loading |
|
defaults write com.apple.Safari HomePage -string "http://www.google.com/" |
|
|
|
# Remove useless icons from Safari’s bookmarks bar |
|
defaults write com.apple.Safari ProxiesInBookmarksBar '("Reading List")' |
|
|
|
# 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 |
|
|
|
|
|
# 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 |
|
|
|
|
|
# TextEdit, and Disk Utility |
|
# ---------------------------------------------------------------------- |
|
|
|
# Use plain text mode for new TextEdit documents |
|
defaults write com.apple.TextEdit RichText -int 0 |
|
# Open and save files as UTF-8 in TextEdit |
|
defaults write com.apple.TextEdit PlainTextEncoding -int 4 |
|
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 |
|
|
|
# Enable the debug menu in Disk Utility |
|
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true |
|
defaults write com.apple.DiskUtility advanced-image-options -bool true |
|
|
|
|
|
# Kill affected applications |
|
# ---------------------------------------------------------------------- |
|
|
|
for app in "Dashboard" "Dock" "Finder" "Safari" "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." |
Nice! 👍