Skip to content

Instantly share code, notes, and snippets.

@Alanaktion
Created October 7, 2015 20:08
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 Alanaktion/743389068fc5184bae6a to your computer and use it in GitHub Desktop.
Save Alanaktion/743389068fc5184bae6a to your computer and use it in GitHub Desktop.
Auto-setup for OS X
#!/bin/bash
# Sets up a new OS X installation with reasonable defaults
# Based partially on https://gist.github.com/saetia/1623487
echo 'Setting defaults...'
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
# Set default Finder location to home folder (~/)
defaults write com.apple.finder NewWindowTarget -string "PfLo" && \
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Disable ext change warning
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# Use current directory as default search scope in Finder
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# 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
# 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
# Enable the Develop menu and the Web Inspector in Safari
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true && \
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 && \
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# Show the ~/Library folder
chflags nohidden ~/Library
# Enable text copying from Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool YES
# Auto-play videos when opened with QuickTime Player
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1
if [[ $USER != 'root' ]]; then
echo -n "Enable passwordless sudo for current user? [y/n] "
read pwdless
if [[ $pwdless == 'y' ]]; then
sudo bash -c "echo '$USER ALL=(ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers"
echo "Passwordless sudo enabled for $USER"
else
echo "Skipping passwordless sudo."
fi
fi
echo 'Install Homebrew? [y/n]'
read yn
if [[ $yn == 'y' ]]; then
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo 'Install recommended packages? [y/n]'
read yn
if [[ $yn == 'y' ]]; then
brew install wget htop cmatrix openssl ssh-copy-id caskroom/cask/brew-cask
fi
echo 'Install desktop apps (Chrome, Sublime, iTerm, etc)? [y/n]'
read yn
if [[ $yn == 'y' ]]; then
# enable fonts & dev/beta versions
brew tap caskroom/fonts
brew tap caskroom/versions
# install apps
brew cask install \
font-source-code-pro \
sublime-text-dev \
querious \
google-chrome \
firefox \
virtualbox \
imageoptim \
spotify
fi
fi
sudo xcrun cc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment