Skip to content

Instantly share code, notes, and snippets.

@kizbitz
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kizbitz/996e1e20dcb2af9787d0 to your computer and use it in GitHub Desktop.
Save kizbitz/996e1e20dcb2af9787d0 to your computer and use it in GitHub Desktop.
#!/bin/bash
fonts=(
font-liberation-mono-for-powerline
)
tap_packages=(
homebrew/dupes
caskroom/fonts
)
brew_packages=(
bash
caskroom/cask/brew-cask
coreutils
findutils
fish
git
homebrew/dupes/grep
pass
python
tmux
tree
vim
)
cask_packages=(
dropbox
firefox
google-chrome
iterm2
parallels-desktop
slack
)
cd
sudo -v
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
echo -e "\nInstalling homebrew ..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew update
echo -e "\nInstalling tap packages ..."
brew tap "${tap_packages[@]}"
echo -e "\nInstalling brew packages ..."
brew install "${brew_packages[@]}"
echo -e "\nInstalling cask packages ..."
brew cask install --appdir="/Applications" "${cask_packages[@]}"
brew cask install "${fonts[@]}"
echo -e "\nCleaning up ..."
brew cleanup
brew cask cleanup
# directories
mkdir -p git sandbox sshots
# most of these from: https://gist.github.com/brandonb927/3195465
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# hostname for sharing
sudo scutil --set ComputerName "kizbitz-mac"
sudo scutil --set HostName "kizbitz-mac"
sudo scutil --set LocalHostName "kizbitz-mac"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "kizbitz-mac"
# hide the time machine, volume, user, and bluetooth icons
# Get the system Hardware UUID and use it for the next menubar stuff
for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do
defaults write "${domain}" dontAutoLoad -array \
"/System/Library/C reServices/Menu Extras/TimeMachine.menu" \
"/System/Library/CoreServices/Menu Extras/Volume.menu" \
"/System/Library/CoreServices/Menu Extras/User.menu"
done
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"
# hide the spotlight icon
# sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
# increase the window resize speed for Cocoa applications
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# expand the save panel
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt`
defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
# save to disk, rather than iCloud
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# 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
# check for software updates daily
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# remove duplicates in the 'Open With' menu
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
# disable smart quotes and smart dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# disable hibernation (speeds up entering sleep mode)
sudo pmset -a hibernatemode 0
# disable the sudden motion sensor
sudo pmset -a sms 0
# disable system-wide resume
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
# disable the menubar transparency
defaults write com.apple.universalaccess reduceTransparency -bool true
# speed up wake from sleep to 24 hours from an hour
sudo pmset -a standbydelay 86400
# 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 (enable Tab in modal dialogs, menu windows, etc.)
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# disable press-and-hold for special keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# trackpad & mouse speed
defaults write -g com.apple.trackpad.scaling 2
defaults write -g com.apple.mouse.scaling 2.5
# turn off keyboard illumination when computer is not used for 2 minutes
defaults write com.apple.BezelServices kDimTime -int 120
# disable display from automatically adjusting brightness
sudo defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Display Enabled" -bool false
# disable keyboard from automatically adjusting backlight brightness in low light
sudo defaults write /Library/Preferences/com.apple.iokit.AmbientLightSensor "Automatic Keyboard Enabled" -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
# screenshot location
defaults write com.apple.screencapture location -string "~/sshots"
# screenshot format
defaults write com.apple.screencapture type -string "png"
# enable subpixel font rendering on non-Apple LCDs
defaults write NSGlobalDomain AppleFontSmoothing -int 2
# enable HiDPI display mode
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
# show icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false
# show hidden files in finder
defaults write com.apple.Finder AppleShowAllFiles -bool true
# show dotfiles in finder
defaults write com.apple.finder AppleShowAllFiles TRUE
# show all filename extensions in finder
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# show status bar in finder
defaults write com.apple.finder ShowStatusBar -bool true
# display full POSIX path as finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# use column view in all finder windows
defaults write com.apple.finder FXPreferredViewStyle Clmv
# avoid creation of .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
# allow text selection in Quick Look/Preview in Finder
defaults write com.apple.finder QLEnableTextSelection -bool true
# 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
# wipe all (default) app icons from the Dock
defaults write com.apple.dock persistent-apps -array
# set the icon size of dock items to 36 pixels
defaults write com.apple.dock tilesize -int 36
# speed up mission control animations
defaults write com.apple.dock expose-animation-duration -float 0.1
# group windows by application
defaults write com.apple.dock "expose-group-by-app" -bool false
# set dock to auto-hide and remove the auto-hiding delay
defaults write com.apple.dock autohide -bool true
defaults write com.apple.dock autohide-delay -float 0
defaults write com.apple.dock autohide-time-modifier -float 0
# don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# hide safari's bookmarks bar
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 debug menu
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# make safari's search banners default to contains instead of starts with"
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# remove useless icons from safari's bookmarks bar
defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# 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 the backswipe in chrome
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false
# use the system-native print preview dialog in chrome
defaults write com.google.Chrome DisablePrintPreview -bool true
defaults write com.google.Chrome.canary DisablePrintPreview -bool true
# set email addresses to copy as 'foo@example.com' instead of 'Foo Bar <foo@example.com>' in Mail.app
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# enable UTF-8 ONLY in Terminal.app and setting the pro theme
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"
# 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
echo -e "\nFinished ..."
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment