diff --git a/dotfiles/lib/shellrc/brew.sh b/dotfiles/lib/shellrc/brew.sh index b08219ca..3ff21a06 100755 --- a/dotfiles/lib/shellrc/brew.sh +++ b/dotfiles/lib/shellrc/brew.sh @@ -119,7 +119,7 @@ function do_the_brew() { esac done echo "Installing the following packages:" - for package_name in "${install_items[@]}"; do echo $package_name; done; + for package_name in "${install_items[@]}"; do printf '\t%s\n' $package_name; done; brew update brew_install_items $install_items brew cleanup diff --git a/dotfiles/lib/shellrc/functions.sh b/dotfiles/lib/shellrc/functions.sh index f03467fe..0fa727d6 100644 --- a/dotfiles/lib/shellrc/functions.sh +++ b/dotfiles/lib/shellrc/functions.sh @@ -228,10 +228,10 @@ function ss() { } function git_config_string() { - git config -f $1 --list | xargs -I kv sh -c "echo \\\"kv\\\"" | xargs | tr '\n' ' ' + git config -f $1 --list | xargs -I kv printf '-c \"%s\" ' kv } -function brew_for_multiple_user() { +function brew_for_multiple_users() { sudo chgrp -R admin /usr/local sudo chmod -R g+w /usr/local sudo chgrp -R admin /Library/Caches/Homebrew diff --git a/dotfiles/lib/shellrc/python.sh b/dotfiles/lib/shellrc/python.sh index a2f8d132..41fbab61 100644 --- a/dotfiles/lib/shellrc/python.sh +++ b/dotfiles/lib/shellrc/python.sh @@ -1,4 +1,5 @@ function install_python_packages() { + easy_install pip ESSENTIAL=(ipdb ipython virtualenv) FOR_EDITOR=(jedi pyflakes) USEFUL=( diff --git a/dotfiles/lib/shellrc/vim.sh b/dotfiles/lib/shellrc/vim.sh index 8cc01940..ea183fec 100644 --- a/dotfiles/lib/shellrc/vim.sh +++ b/dotfiles/lib/shellrc/vim.sh @@ -1,5 +1,3 @@ function vimstall() { - # This sucks, but BundleInstall fails otherwise. - sudo chmod -R 775 $(readlink -f ~/.vim) vim +BundleInstall! +q +q } diff --git a/resources/osx.sh b/resources/osx.sh index 991e3e9e..c8984b0c 100755 --- a/resources/osx.sh +++ b/resources/osx.sh @@ -1,327 +1,327 @@ -#!/usr/bin/env bash +function osx_config() { + # Ask for the administrator password upfront + sudo -v -# 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 & -# 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 # + ############################################################################### -############################################################################### -# General UI/UX # -############################################################################### + # Menu bar: disable transparency + defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false -# Menu bar: disable transparency -defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false + # 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" -# 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" + # Menu bar: hide the useless Time Machine and Volume icons + defaults write com.apple.systemuiserver menuExtras -array "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" "/System/Library/CoreServices/Menu Extras/AirPort.menu" "/System/Library/CoreServices/Menu Extras/Battery.menu" "/System/Library/CoreServices/Menu Extras/Clock.menu" -# Menu bar: hide the useless Time Machine and Volume icons -defaults write com.apple.systemuiserver menuExtras -array "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" "/System/Library/CoreServices/Menu Extras/AirPort.menu" "/System/Library/CoreServices/Menu Extras/Battery.menu" "/System/Library/CoreServices/Menu Extras/Clock.menu" + # Always show scrollbars + defaults write NSGlobalDomain AppleShowScrollBars -string "Automatic" -# Always show scrollbars -defaults write NSGlobalDomain AppleShowScrollBars -string "Automatic" + # Disable opening and closing window animations + defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false -# Disable opening and closing window animations -defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false + # Increase window resize speed for Cocoa applications + defaults write NSGlobalDomain NSWindowResizeTime -float 0.08 -# Increase window resize speed for Cocoa applications -defaults write NSGlobalDomain NSWindowResizeTime -float 0.08 + # Disable the “Are you sure you want to open this application?” dialog + defaults write com.apple.LaunchServices LSQuarantine -bool false -# Disable the “Are you sure you want to open this application?” dialog -defaults write com.apple.LaunchServices LSQuarantine -bool false + # Display ASCII control characters using caret notation in standard text views + # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` + defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true -# Display ASCII control characters using caret notation in standard text views -# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` -defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true + # Disable Resume system-wide + defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false -# Disable Resume system-wide -defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false + # Disable automatic termination of inactive apps + defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true -# Disable automatic termination of inactive apps -defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true + # Set Help Viewer windows to non-floating mode + defaults write com.apple.helpviewer DevMode -bool true -# Set Help Viewer windows to non-floating mode -defaults write com.apple.helpviewer DevMode -bool true + # 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 -# 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 + # Restart automatically if the computer freezes + systemsetup -setrestartfreeze on -# Restart automatically if the computer freezes -systemsetup -setrestartfreeze on + # Never go into computer sleep mode + systemsetup -setcomputersleep Off > /dev/null -# Never go into computer sleep mode -systemsetup -setcomputersleep Off > /dev/null + # Check for software updates daily, not just once per week + defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 -# 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, 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: 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 + # Increase sound quality for Bluetooth headphones/headsets + defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 -# Increase sound quality for Bluetooth headphones/headsets -defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 + # Enable full keyboard access for all controls + # (e.g. enable Tab in modal dialogs) + defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 -# Enable full keyboard access for all controls -# (e.g. enable Tab in modal dialogs) -defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 + # Enable access for assistive devices + echo -n 'a' | sudo tee /private/var/db/.AccessibilityAPIEnabled > /dev/null 2>&1 + sudo chmod 444 /private/var/db/.AccessibilityAPIEnabled + # TODO: avoid GUI password prompt somehow (http://apple.stackexchange.com/q/60476/4408) -# Enable access for assistive devices -echo -n 'a' | sudo tee /private/var/db/.AccessibilityAPIEnabled > /dev/null 2>&1 -sudo chmod 444 /private/var/db/.AccessibilityAPIEnabled -# TODO: avoid GUI password prompt somehow (http://apple.stackexchange.com/q/60476/4408) + # 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 press-and-hold for keys in favor of key repeat + defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false -# 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 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 -# Set a blazingly fast keyboard repeat rate -defaults write NSGlobalDomain KeyRepeat -int 1 + # 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 -# 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`, and `true` with `false`. + defaults write NSGlobalDomain AppleLanguages -array "en" + defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" + defaults write NSGlobalDomain AppleMeasurementUnits -string "Inches" + defaults write NSGlobalDomain AppleMetricUnits -bool false -# Set language and text formats -# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with -# `Inches`, and `true` with `false`. -defaults write NSGlobalDomain AppleLanguages -array "en" -defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" -defaults write NSGlobalDomain AppleMeasurementUnits -string "Inches" -defaults write NSGlobalDomain AppleMetricUnits -bool false + # Disable auto-correct + defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false -# Disable auto-correct -defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false + ############################################################################### + # Screen # + ############################################################################### -############################################################################### -# Screen # -############################################################################### + # Save screenshots to the desktop + defaults write com.apple.screencapture location -string "$HOME/Desktop" -# Save screenshots to the desktop -defaults write com.apple.screencapture location -string "$HOME/Desktop" + # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) + defaults write com.apple.screencapture type -string "png" -# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) -defaults write com.apple.screencapture type -string "png" + # Disable shadow in screenshots + defaults write com.apple.screencapture disable-shadow -bool true -# 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 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 -# Enable HiDPI display modes (requires restart) -sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true + ############################################################################### + # Finder # + ############################################################################### -############################################################################### -# Finder # -############################################################################### + # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons + defaults write com.apple.finder QuitMenuItem -bool true -# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons -defaults write com.apple.finder QuitMenuItem -bool true + # 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 -# 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 hidden files by default + defaults write com.apple.finder AppleShowAllFiles -bool true -# Finder: show hidden files by default -defaults write com.apple.finder AppleShowAllFiles -bool true + # Finder: show all filename extensions + defaults write NSGlobalDomain AppleShowAllExtensions -bool true -# Finder: show all filename extensions -defaults write NSGlobalDomain AppleShowAllExtensions -bool true + # Finder: show status bar + defaults write com.apple.finder ShowStatusBar -bool true -# 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 -# Finder: allow text selection in Quick Look -defaults write com.apple.finder QLEnableTextSelection -bool true + # Display full POSIX path as Finder window title + defaults write com.apple.finder _FXShowPosixPathInTitle -bool true -# Display full POSIX path as Finder window title -defaults write com.apple.finder _FXShowPosixPathInTitle -bool true + # When performing a search, search the current folder by default + defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" -# When performing a search, search the current folder by default -defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" + # Disable the warning when changing a file extension + defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false -# 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 -# 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 -# 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 -# 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 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 -# 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 -# 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 -# 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 + # Increase the size of icons on the desktop and in other icon views + /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist + /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist -# Increase the size of icons on the desktop and in other icon views -/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist -/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/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" -# 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 -# Disable the warning before emptying the Trash -defaults write com.apple.finder WarnOnEmptyTrash -bool false + # Don't Empty Trash securely by default + defaults write com.apple.finder EmptyTrashSecurely -bool false -# Don't 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 AirDrop over Ethernet and on unsupported Macs running Lion -defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true + # Show the ~/Library folder + chflags nohidden ~/Library -# Show the ~/Library folder -chflags nohidden ~/Library + # Remove Dropbox’s green checkmark icons in Finder + file=/Applications/Dropbox.app/Contents/Resources/check.icns + [ -e "$file" ] && mv -f "$file" "$file.bak" + unset file -# Remove Dropbox’s green checkmark icons in Finder -file=/Applications/Dropbox.app/Contents/Resources/check.icns -[ -e "$file" ] && mv -f "$file" "$file.bak" -unset file + ############################################################################### + # Dock & hot corners # + ############################################################################### -############################################################################### -# Dock & hot corners # -############################################################################### + # Enable highlight hover effect for the grid view of a stack (Dock) + defaults write com.apple.dock mouse-over-hilite-stack -bool true -# Enable highlight hover effect for the grid view of a stack (Dock) -defaults write com.apple.dock mouse-over-hilite-stack -bool true + # Set the icon size of Dock items to 36 pixels + defaults write com.apple.dock tilesize -int 36 -# Set the icon size of Dock items to 36 pixels -defaults write com.apple.dock tilesize -int 36 + # Enable spring loading for all Dock items + defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true -# 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 -# Show indicator lights for open applications in the Dock -defaults write com.apple.dock show-process-indicators -bool true + # Don’t group windows by application in Mission Control + # (i.e. use the old Exposé behavior instead) + defaults write com.apple.dock expose-group-by-app -bool false -# Don’t group windows by application in Mission Control -# (i.e. use the old Exposé behavior instead) -defaults write com.apple.dock expose-group-by-app -bool false + # Don’t show Dashboard as a Space + defaults write com.apple.dock dashboard-in-overlay -bool true -# Don’t show Dashboard as a Space -defaults write com.apple.dock dashboard-in-overlay -bool true + # Remove the auto-hiding Dock delay + defaults write com.apple.Dock autohide-delay -float 0 -# Remove the auto-hiding Dock delay -defaults write com.apple.Dock autohide-delay -float 0 + # Enable the 2D Dock + #defaults write com.apple.dock no-glass -bool true -# Enable the 2D Dock -#defaults write com.apple.dock no-glass -bool true + # Automatically hide and show the Dock + defaults write com.apple.dock autohide -bool true -# Automatically hide and show the Dock -defaults write com.apple.dock autohide -bool true + # Make Dock icons of hidden applications translucent + defaults write com.apple.dock showhidden -bool true -# 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 -# Reset Launchpad -find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete + # Hot corners + # Possible values: + # 0: no-op + # 2: Mission Control + # 3: Show application windows + # 4: Desktop + # 5: Start screen saver + # 6: Disable screen saver + # 7: Dashboard + # 10: Put display to sleep + # 11: Launchpad + # Top right screen corner → Desktop + defaults write com.apple.dock wvous-tr-corner -int 4 + defaults write com.apple.dock wvous-tr-modifier -int 0 + defaults write com.apple.dock wvous-bl-corner -int 5 + defaults write com.apple.dock wvous-bl-modifier -int 0 -# Hot corners -# Possible values: -# 0: no-op -# 2: Mission Control -# 3: Show application windows -# 4: Desktop -# 5: Start screen saver -# 6: Disable screen saver -# 7: Dashboard -# 10: Put display to sleep -# 11: Launchpad -# Top right screen corner → Desktop -defaults write com.apple.dock wvous-tr-corner -int 4 -defaults write com.apple.dock wvous-tr-modifier -int 0 -defaults write com.apple.dock wvous-bl-corner -int 5 -defaults write com.apple.dock wvous-bl-modifier -int 0 + ############################################################################### + # Time Machine # + ############################################################################### -############################################################################### -# Time Machine # -############################################################################### + # Prevent Time Machine from prompting to use new hard drives as backup volume + defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true -# 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 -# Disable local Time Machine backups -hash tmutil &> /dev/null && sudo tmutil disablelocal + ############################################################################### + # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # + ############################################################################### -############################################################################### -# Address Book, Dashboard, iCal, TextEdit, and Disk Utility # -############################################################################### + # 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 -# 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 + ############################################################################### + # Mac App Store # + ############################################################################### -############################################################################### -# Mac App Store # -############################################################################### + # Enable the WebKit Developer Tools in the Mac App Store + defaults write com.apple.appstore WebKitDeveloperExtras -bool true -# Enable the WebKit Developer Tools in the Mac App Store -defaults write com.apple.appstore WebKitDeveloperExtras -bool true + # Enable Debug Menu in the Mac App Store + defaults write com.apple.appstore ShowDebugMenu -bool true -# Enable Debug Menu in the Mac App Store -defaults write com.apple.appstore ShowDebugMenu -bool true + ############################################################################### + # Google Chrome & Google Chrome Canary # + ############################################################################### -############################################################################### -# Google Chrome & Google Chrome Canary # -############################################################################### + # 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/*" -# 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/*" + ############################################################################### + # Transmission.app # + ############################################################################### -############################################################################### -# Transmission.app # -############################################################################### + # Use `~/Documents/Torrents` to store incomplete downloads + defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true + defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" -# Use `~/Documents/Torrents` to store incomplete downloads -defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true -defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" + # Don’t prompt for confirmation before downloading + defaults write org.m0k.transmission DownloadAsk -bool false -# Don’t prompt for confirmation before downloading -defaults write org.m0k.transmission DownloadAsk -bool false + # Trash original torrent files + defaults write org.m0k.transmission DeleteOriginalTorrent -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 + # Hide the donate message + defaults write org.m0k.transmission WarningDonate -bool false + # Hide the legal disclaimer + defaults write org.m0k.transmission WarningLegal -bool false +} diff --git a/setup.sh b/setup.sh index 1146e526..b25b8492 100755 --- a/setup.sh +++ b/setup.sh @@ -4,6 +4,7 @@ source dotfiles/lib/shellrc/functions.sh source dotfiles/lib/shellrc/brew.sh source dotfiles/lib/shellrc/python.sh source dotfiles/lib/shellrc/vim.sh +source resources/osx.sh DOTFILES_DIRECTORY="$(dotfiles_abspath)/dotfiles" @@ -74,6 +75,7 @@ function setup() { fi while getopts "acosbpev" OPTCHAR; do + local real_opt_ind=$OPTIND case $OPTCHAR in a) source resources/apt-get.sh @@ -90,7 +92,7 @@ function setup() { ;; o) sudo -v - source resources/osx.sh + osx_config ;; s) symlink_dotfiles_prompt @@ -104,10 +106,11 @@ function setup() { install_python_packages $REPLY ;; e) - case uname in + case $(uname) in Darwin) get_command_line_tools get_brew && do_the_brew -au + osx_config ;; Linux) apt-get @@ -115,7 +118,6 @@ function setup() { esac install_python_packages -a symlink_dotfiles - source resources/osx.sh vimstall ;; v) @@ -126,6 +128,7 @@ function setup() { return ;; esac + OPTIND=$real_opt_ind done }