Created
September 3, 2018 04:33
-
-
Save dsully/e4ebe84db57f31157925157caf558364 to your computer and use it in GitHub Desktop.
Script to bring up a new Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PACKAGES=( | |
clipper | |
cloc | |
direnv | |
direnv | |
dnstracer | |
fd | |
git | |
htop-osx | |
jsonpp | |
loc | |
md5sha1sum | |
mobile-shell | |
namebench | |
netcat6 | |
pdfcrack | |
pidof | |
pkill | |
puf | |
reattach-to-user-namespace | |
rename | |
ripgrep | |
sshuttle | |
tree | |
unrar | |
vbindiff | |
wget | |
) | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
fi | |
defaults write com.google.Chrome AutoSelectCertificateForUrls -array | |
defaults write com.google.Chrome AutoSelectCertificateForUrls -array-add -string '{"pattern":"https://[*.]electricrain.com","filter":{"ISSUER":{"CN":"Dan Sully"}}}' | |
brew update | |
brew install grep --default-names | |
brew install rsync | |
brew install ${PACKAGES[@]} | |
# Install Vim while overriding the system vim. | |
# High Sierra has a modern vim. | |
# brew install vim --without-perl --without-ruby --without-python --with-override-system-vi | |
brew upgrade | |
brew prune | |
brew cleanup | |
# Install Apps? | |
# echo "Installing apps.." | |
# brew cask install --appdir="/Applications" ${APPS[@]} | |
# brew cask alfred link | |
# https://github.com/lra/mackup | |
pip install mackup | |
# System Setup | |
# http://www.macworld.com/article/161330/2011/07/four_lion_terminal_hacks.html#lsrc.rss_weblogs_macuser | |
defaults write -g ApplePressAndHoldEnabled -bool false | |
defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false | |
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false | |
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 | |
# Disable Dashboard | |
defaults write com.apple.dashboard mcx-disabled -boolean YES | |
# Disable Mission Control | |
defaults write com.apple.dock mcx-expose-disabled -bool TRUE | |
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 "Automatically quit printer app once the print jobs complete" | |
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true | |
echo "Save to disk, rather than iCloud, by default." | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
echo "Check for software updates daily, not just once per week" | |
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 | |
echo "Disable smart quotes & dashes." | |
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false | |
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false | |
echo "Disable hibernation. (speeds up entering sleep mode)." | |
sudo pmset -a hibernatemode 0 | |
echo "Disable the sudden motion sensor? (it's not useful for SSDs/current MacBooks)" | |
sudo pmset -a sms 0 | |
echo "Speeding up wake from sleep to 24 hours from an hour" | |
# http://www.cultofmac.com/221392/quick-hack-speeds-up-retina-macbooks-wake-from-sleep-os-x-tips/ | |
sudo pmset -a standbydelay 86400 | |
echo "Enabling full keyboard access for all controls (enable Tab in modal dialogs, menu windows, etc.)" | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
echo "Enabling subpixel font rendering on non-Apple LCDs" | |
defaults write NSGlobalDomain AppleFontSmoothing -int 2 | |
echo "Enabling HiDPI display modes (requires restart)" | |
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true | |
echo "Show icons for hard drives, servers, and removable media on the desktop." | |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true | |
echo "Disable the warning when changing a file extension." | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
#echo "Avoid creation of .DS_Store files on network volumes." | |
#defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
defaults write com.apple.desktopservices UseBareEnumeration -bool true | |
echo "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 | |
echo "Wipe all (default) app icons from the Dock." | |
defaults write com.apple.dock persistent-apps -array | |
echo "Setting the icon size of Dock items to 36 pixels for optimal size/screen-realestate" | |
defaults write com.apple.dock tilesize -int 36 | |
echo "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 | |
echo "Hiding Safari's bookmarks bar by default" | |
defaults write com.apple.Safari ShowFavoritesBar -bool false | |
echo "Hiding Safari's sidebar in Top Sites" | |
defaults write com.apple.Safari ShowSidebarInTopSites -bool false | |
echo "Disabling Safari's thumbnail cache for History and Top Sites" | |
defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 | |
echo "Enabling Safari's debug menu" | |
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true | |
echo "Disable Safari notifications" | |
defaults write com.apple.Safari CanPromptForPushNotifications -bool false | |
echo "Making Safari's search banners default to Contains instead of Starts With" | |
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false | |
echo "Removing useless icons from Safari's bookmarks bar" | |
defaults write com.apple.Safari ProxiesInBookmarksBar "()" | |
echo "Allow hitting the Backspace key to go to the previous page in history" | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true | |
echo "Enabling 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 | |
echo "Adding a context menu item for showing the Web Inspector in web views" | |
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true | |
echo "Setting email addresses to copy as '[email protected]' instead of 'Foo Bar <[email protected]>' in Mail.app" | |
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false | |
echo "Prevent Time Machine from prompting to use new hard drives as backup volume." | |
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true | |
echo "Disable local Time Machine backups? (This can take up a ton of SSD space on <128GB SSDs)" | |
hash tmutil &> /dev/null && sudo tmutil disablelocal | |
echo "Disable smart quotes in Messages.app? (it's annoying for messages that contain code)" | |
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false | |
# http://www.macosxhints.com/article.php?story=2008021122525348 | |
echo "Turn off Spaces auto-switching" | |
defaults write com.apple.Dock workspaces-auto-swoosh -bool NO | |
echo "Turn off auto-termination" | |
defaults write -g NSDisableAutomaticTermination -bool yes | |
find ~/Library/Application\ Support/Dock -name "*.db" -maxdepth 1 -delete | |
for app in "cfprefsd" "Dock" "Finder" "Safari" "SystemUIServer"; 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