Skip to content

Instantly share code, notes, and snippets.

@dprevite
Forked from brandonb927/osx-for-hackers.sh
Last active November 28, 2016 05:43
Show Gist options
  • Save dprevite/977394a8699a4e304be9 to your computer and use it in GitHub Desktop.
Save dprevite/977394a8699a4e304be9 to your computer and use it in GitHub Desktop.
My fork of osx-for-hackers.sh
#!/bin/sh
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
yellow='\033[0;33m'
blue='\033[0;34m'
magenta='\033[0;35m'
cyan='\033[0;36m'
# Reset text attributes to normal + without clearing screen.
alias Reset="tput sgr0"
# Color-echo.
# arg $1 = message
# arg $2 = Color
cecho() {
echo "${2}${1}"
Reset # Reset to normal.
return
}
echo ""
cecho "##############################################" $white
cecho "# This script will make your  Mac awesome." $white
cecho "# Follow the prompts and you'll be fine." $white
cecho "#" $white
cecho "# ~ Happy Hacking ~" $white
cecho "#############################################" $white
echo ""
echo ""
echo "Installing Brew and Cask"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew install caskroom/cask/brew-cask
brew cask alfred link
brew install wget
brew install ack
sudo easy_install pip
brew install zsh
sudo chshl -s zsh
curl -L http://install.ohmyz.sh | sh
brew install git-flow
brew install ssh-copy-id
echo ""
echo "Installing PHP"
curl -s http://php-osx.liip.ch/install.sh | bash -s 5.6
# AWS S3 Command Line Tools
# http://s3tools.org/s3cmd
brew install s3cmd
brew install gpg
###############################################################################
# Cask applications
###############################################################################
brew cask install iterm2
brew cask install atom
brew cask install cakebrew
brew cask install bartender
brew cask install audacity
brew cask install clipmenu
brew cask install alfred
brew cask install evernote
brew cask install filezilla
brew cask install gas-mask
brew cask install putio-adder
brew cask install silverlight
brew cask install synergy
brew cask install truecrypt
brew cask install vlc
brew cask install flux
brew cask install google-chrome
brew cask install skype
brew cask install tower
brew cask install spotify
brew cask install hipchat
brew cask install sequel-pro
brew cask install sublime-text
brew cask install teamviewer
brew cask install vagrant
brew cask install virtualbox
brew cask install java
brew cask install phpstorm
brew cask install colorpicker-skalacolor
brew cask install qlvideo
brew install id3lib
# Install local DNS http://passingcuriosity.com/2013/dnsmasq-dev-osx/
brew install dnsmasq
cp /usr/local/opt/dnsmasq/dnsmasq.conf.example /usr/local/etc/dnsmasq.conf
sudo cp -fv /usr/local/opt/dnsmasq/*.plist /Library/LaunchDaemons
sudo chown root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
vagrant plugin install vagrant-hostsupdater
sudo ln -s /usr/libexec/locate.updatedb /usr/local/bin/updatedb
###############################################################################
# General UI/UX
###############################################################################
echo ""
echo "Setting your computer name (as done via System Preferences → Sharing)"
echo "What would you like it to be?"
read COMPUTER_NAME
sudo scutil --set ComputerName $COMPUTER_NAME
sudo scutil --set HostName $COMPUTER_NAME
sudo scutil --set LocalHostName $COMPUTER_NAME
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string $COMPUTER_NAME
echo ""
echo "Disabling OS X Gate Keeper"
echo "(You'll be able to install any app you want from here on, not just Mac App Store apps)"
sudo spctl --master-disable
sudo defaults write /var/db/SystemPolicy-prefs.plist enabled -string no
defaults write com.apple.LaunchServices LSQuarantine -bool false
echo ""
echo "Increasing the window resize speed for Cocoa applications"
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
echo ""
echo "Expanding the save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
echo ""
echo "Automatically quit printer app once the print jobs complete"
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
echo ""
echo "Check for software updates daily, not just once per week"
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
echo ""
echo "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
echo ""
echo "Disable smart quotes and smart dashes as they're annoying when typing code"
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input
###############################################################################
echo ""
echo "Increasing sound quality for Bluetooth headphones/headsets"
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
echo ""
echo "Enabling full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
###############################################################################
# Screen
###############################################################################
echo ""
echo "Requiring password immediately after sleep or screen saver begins"
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
echo ""
echo "Where do you want screenshots to be stored? (hit ENTER if you want ~/Desktop as default)"
read screenshot_location
if [ -z "$1" ]
then
echo ""
echo "Setting location to ~/Desktop"
defaults write com.apple.screencapture location -string "$HOME/Desktop"
else
echo ""
echo "Setting location to ~/$screenshot_location"
defaults write com.apple.screencapture location -string "$HOME/$screenshot_location"
fi
echo ""
echo "What format should screenshots be saved as? (hit ENTER for PNG, options: BMP, GIF, JPG, PDF, TIFF) "
read screenshot_format
if [ -z "$1" ]
then
echo ""
echo "Setting screenshot format to PNG"
defaults write com.apple.screencapture type -string "png"
else
echo ""
echo "Setting screenshot format to $screenshot_format"
defaults write com.apple.screencapture type -string "$screenshot_format"
fi
echo ""
echo "Enabling subpixel font rendering on non-Apple LCDs"
defaults write NSGlobalDomain AppleFontSmoothing -int 2
echo ""
echo "Enabling HiDPI display modes (requires restart)"
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
###############################################################################
# Finder
###############################################################################
echo ""
echo "Showing icons for hard drives, servers, and removable media on the desktop"
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
echo ""
echo "Show hidden files in Finder by default?"
select yn in "Yes" "No"; do
case $yn in
Yes ) defaults write com.apple.Finder AppleShowAllFiles -bool true
break;;
No ) break;;
esac
done
echo ""
echo "Show dotfiles in Finder by default?"
select yn in "Yes" "No"; do
case $yn in
Yes ) defaults write com.apple.finder AppleShowAllFiles TRUE
break;;
No ) break;;
esac
done
echo ""
echo "Showing all filename extensions in Finder by default"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
echo ""
echo "Showing status bar in Finder by default"
defaults write com.apple.finder ShowStatusBar -bool true
echo ""
echo "Allowing text selection in Quick Look/Preview in Finder by default"
defaults write com.apple.finder QLEnableTextSelection -bool true
echo ""
echo "Displaying full POSIX path as Finder window title"
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
echo ""
echo "Disabling the warning when changing a file extension"
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
echo ""
echo "Avoiding the creation of .DS_Store files on network volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
###############################################################################
# Dock & Mission Control
###############################################################################
echo ""
echo "Speeding up Mission Control animations and grouping windows by application"
defaults write com.apple.dock expose-animation-duration -float 0.1
defaults write com.apple.dock "expose-group-by-app" -bool true
###############################################################################
# Personal Additions
###############################################################################
echo ""
echo "Disable the sudden motion sensor as it's not useful for SSDs"
sudo pmset -a sms 0
###############################################################################
# Kill affected applications
###############################################################################
echo ""
cecho "Done!" $white
echo ""
echo ""
cecho "###############################################################################" $white
echo ""
echo ""
cecho "Note that some of these changes require a logout/restart to take effect." $white
cecho "Killing some open applications in order to take effect." $white
echo ""
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
"Dock" "Finder" "Mail" "Messages" "Safari" "SystemUIServer" \
"Terminal" "Transmission"; do
killall "${app}" > /dev/null 2>&1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment