-
-
Save hansfilipelo/032b5370964a04e3d7b2 to your computer and use it in GitHub Desktop.
This file contains 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/sh | |
# Alot of these configs have been taken from the various places | |
# on the web, most from here | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# 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 | |
} | |
# Set continue to false by default | |
CONTINUE=false | |
echo "" | |
cecho "###############################################" $red | |
cecho "# DO NOT RUN THIS SCRIPT BLINDLY #" $red | |
cecho "# YOU'LL PROBABLY REGRET IT... #" $red | |
cecho "# #" $red | |
cecho "# READ IT THOROUGHLY #" $red | |
cecho "# AND EDIT TO SUIT YOUR NEEDS #" $red | |
cecho "###############################################" $red | |
echo "" | |
echo "" | |
cecho "Have you read through the script you're about to run and " $red | |
cecho "understood that it will make changes to your computer? (y/n)" $red | |
read -r response | |
case $response in | |
[yY]) CONTINUE=true | |
break;; | |
*) break;; | |
esac | |
if ! $CONTINUE; then | |
# Check if we're continuing and output a message if not | |
cecho "Please go read the script, it only takes a few minutes" $red | |
exit | |
fi | |
############################################################################### | |
# General UI/UX | |
############################################################################### | |
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 "Save to disk, rather than iCloud, by default? (y/n)" | |
read -r response | |
case $response in | |
[yY]) | |
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false | |
break;; | |
*) break;; | |
esac | |
echo "" | |
echo "Check for software updates daily, not just once per week" | |
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 | |
echo "" | |
echo "Removing duplicates in the 'Open With' menu" | |
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user | |
################################################################################ | |
# 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 (enable Tab in modal dialogs, menu windows, etc.)" | |
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 | |
echo "" | |
############################################################################### | |
# Finder | |
############################################################################### | |
echo "" | |
echo "Show icons for hard drives, servers, and removable media on the desktop? (y/n)" | |
case $response in | |
[yY]) | |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true | |
break;; | |
*) break;; | |
esac | |
echo "" | |
echo "Show all filename extensions in Finder by default? (y/n)" | |
read -r response | |
case $response in | |
[yY]) | |
defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
break;; | |
*) break;; | |
esac | |
echo "" | |
echo "Use column view in all Finder windows by default? (y/n)" | |
read -r response | |
case $response in | |
[yY]) | |
defaults write com.apple.finder FXPreferredViewStyle Clmv | |
break;; | |
*) break;; | |
esac | |
echo "" | |
echo "Allowing text selection in Quick Look/Preview in Finder by default" | |
defaults write com.apple.finder QLEnableTextSelection -bool true | |
############################################################################### | |
# Dock & Mission Control | |
############################################################################### | |
echo "" | |
echo "Disable Mission Control animations, launching apps animations and grouping windows by application (y/n)" | |
read -r response | |
case $response in | |
[yY]) | |
defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 | |
defaults write com.apple.dock "expose-group-by-app" -bool false | |
defaults write com.apple.dock expose-animation-duration -float 0 | |
defaults write com.apple.dock launchanim -bool false | |
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false | |
break;; | |
*) break;; | |
esac | |
############################################################################### | |
# Chrome, Safari, & WebKit | |
############################################################################### | |
echo "" | |
echo "Privacy: Don’t send search queries to Apple" | |
defaults write com.apple.Safari UniversalSearchEnabled -bool false | |
defaults write com.apple.Safari SuppressSearchSuggestions -bool true | |
echo "" | |
echo "Using 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 | |
############################################################################### | |
# Time Machine | |
############################################################################### | |
echo "" | |
echo "Prevent Time Machine from prompting to use new hard drives as backup volume? (y/n)" | |
read -r response | |
case $response in | |
[yY]) | |
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true | |
break;; | |
*) break;; | |
esac | |
echo "" | |
echo "Disable local versions of files? (This can take up a ton of SSD space on <128GB SSDs) (y/n)" | |
read -r response | |
case $response in | |
[yY]) | |
echo "Please enter password when asked: " | |
hash tmutil &> /dev/null && sudo tmutil disablelocal | |
break;; | |
*) break;; | |
esac | |
############################################################################### | |
# Kill affected applications | |
############################################################################### | |
echo "" | |
cecho "Done!" $cyan | |
echo "" | |
echo "" | |
cecho "################################################################################" $white | |
echo "" | |
echo "" | |
cecho "Note that some of these changes require a logout/restart to take effect." $red | |
cecho "Killing some open applications in order to take effect." $red | |
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