Skip to content

Instantly share code, notes, and snippets.

@y4rr
Created July 3, 2019 22:06
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 y4rr/ed2ba70bb96068a5970c4ad3892b0222 to your computer and use it in GitHub Desktop.
Save y4rr/ed2ba70bb96068a5970c4ad3892b0222 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
source ./lib_sh/echos.sh
source ./lib_sh/requirers.sh
bot "Hi! I'm going to install tooling and tweak your system settings. Here I go..."
if ! sudo grep -q "%wheel ALL=(ALL) NOPASSWD: ALL" "/etc/sudoers"; then
bot "I need you to enter your sudo password so I can install some things:"
sudo -v
# keep alive: update existing sudo time stamp until the script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
bot "Do you want me to setup this machine to allow you to run sudo without a password?\nPlease read here to see what I am doing:\nhttp://wiki.summercode.com/sudo_without_a_password_in_mac_os_x \n"
read -r -p "Make sudo passwordless? [y|N] " response
if [[ $response =~ (yes|y|Y) ]];then
sudo cp /etc/sudoers /etc/sudoers.back
echo '%wheel ALL=(ALL) NOPASSWD: ALL' | sudo tee -a /etc/sudoers > /dev/null
sudo dscl . append /Groups/wheel GroupMembership $(whoami)
bot "You can now run sudo commands without password!"
fi
fi
grep 'user = GITHUBUSER' ./homedir/.gitconfig > /dev/null 2>&1
if [[ $? = 0 ]]; then
read -r -p "What is your github.com username? " githubuser
fullname=`osascript -e "long user name of (system info)"`
if [[ -n "$fullname" ]];then
lastname=$(echo $fullname | awk '{print $2}');
firstname=$(echo $fullname | awk '{print $1}');
fi
if [[ -z $lastname ]]; then
lastname=`dscl . -read /Users/$(whoami) | grep LastName | sed "s/LastName: //"`
fi
if [[ -z $firstname ]]; then
firstname=`dscl . -read /Users/$(whoami) | grep FirstName | sed "s/FirstName: //"`
fi
email=`dscl . -read /Users/$(whoami) | grep EMailAddress | sed "s/EMailAddress: //"`
if [[ ! "$firstname" ]];then
response='n'
else
echo -e "I see that your full name is $COL_YELLOW$firstname $lastname$COL_RESET"
read -r -p "Is this correct? [Y|n] " response
fi
if [[ $response =~ ^(no|n|N) ]];then
read -r -p "What is your first name? " firstname
read -r -p "What is your last name? " lastname
fi
fullname="$firstname $lastname"
bot "Great $fullname, "
if [[ ! $email ]];then
response='n'
else
echo -e "The best I can make out, your email address is $COL_YELLOW$email$COL_RESET"
read -r -p "Is this correct? [Y|n] " response
fi
if [[ $response =~ ^(no|n|N) ]];then
read -r -p "What is your email? " email
if [[ ! $email ]];then
error "you must provide an email to configure .gitconfig"
exit 1
fi
fi
running "replacing items in .gitconfig with your info ($COL_YELLOW$fullname, $email, $githubuser$COL_RESET)"
sed -i "s/GITHUBFULLNAME/$firstname $lastname/" ./homedir/.gitconfig > /dev/null 2>&1 | true
if [[ ${PIPESTATUS[0]} != 0 ]]; then
echo
running "looks like you are using MacOS sed rather than gnu-sed, accommodating"
sed -i '' "s/GITHUBFULLNAME/$firstname $lastname/" ./homedir/.gitconfig;
sed -i '' 's/GITHUBEMAIL/'$email'/' ./homedir/.gitconfig;
sed -i '' 's/GITHUBUSER/'$githubuser'/' ./homedir/.gitconfig;
ok
else
echo
bot "looks like you are already using gnu-sed. woot!"
sed -i 's/GITHUBEMAIL/'$email'/' ./homedir/.gitconfig;
sed -i 's/GITHUBUSER/'$githubuser'/' ./homedir/.gitconfig;
fi
fi
WP_NAME="Earth.heic"
MD5_NEWWP=$(md5 configs/wallpaper/$WP_NAME | awk '{print $4}')
MD5_OLDWP=$(md5 /System/Library/CoreServices/DefaultDesktop.heic | awk '{print $4}')
if [[ "$MD5_NEWWP" != "$MD5_OLDWP" ]]; then
running "set a custom wallpaper"
rm -rf ~/Library/Application\ Support/Dock/desktoppicture.db
sudo rm -f /System/Library/CoreServices/DefaultDesktop.heic > /dev/null 2>&1
sudo cp ./configs/wallpaper/$WP_NAME /System/Library/CoreServices/DefaultDesktop.heic
sudo cp ./configs/wallpaper/$WP_NAME /Library/Desktop\ Pictures
osascript -e 'tell application "Finder" to set desktop picture to "/Library/Desktop Pictures/Earth.heic" as POSIX file';
ok
fi
function check_brew_process() {
if [[ -d "/usr/local/var/homebrew/locks" ]]; then
running "kill homebrew process"
rm -rf /usr/local/var/homebrew/locks
ok
fi
}
brew_bin=$(which brew) 2>&1 > /dev/null
if [[ $? != 0 ]]; then
running "installing homebrew"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
if [[ $? != 0 ]]; then
error "unable to install homebrew, script $0 abort!"
exit 2
fi
else
bot "before installing brew packages, we can upgrade any outdated packages."
read -r -p "run brew upgrade? [y|N] " response
if [[ $response =~ ^(y|yes|Y) ]];then
action "updating homebrew"
brew update
ok
action "upgrade brew packages..."
brew upgrade
ok "brews updated..."
else
ok "skipped brew package upgrades."
fi
fi
function check_brew_tap() {
output=$(brew tap | grep $2)
if [[ $? != 0 ]]; then
running "installing $1/homebrew-$2"
if [[ $# == 2 ]]; then
brew tap $1/$2
elif [[ $# == 3 ]]; then
brew tap $1/$2 https://$3.com/$1/homebrew-$2.git
else
echo "skipping..."
fi
ok
fi
}
check_brew_tap leejongyoung tools gitlab
check_brew_tap homebrew cask-fonts
function check_brew_formula() {
output=$(brew list | grep $1)
if [[ $? != 0 ]]; then
running "installing $1"
require_brew $1
ok
fi
}
check_brew_formula git
check_brew_formula zsh
check_brew_formula nvm
CURRENTSHELL=$(dscl . -read /Users/$USER UserShell | awk '{print $2}')
if [[ "$CURRENTSHELL" != "/usr/local/bin/zsh" ]]; then
running "setting newer homebrew zsh (/usr/local/bin/zsh) as your shell (password required)"
sudo dscl . -change /Users/$USER UserShell $SHELL /usr/local/bin/zsh > /dev/null 2>&1
ok
fi
if [[ ! -d "./oh-my-zsh/custom/themes/multiline" ]]; then
git clone https://github.com/jan-auer/zsh-multiline.git oh-my-zsh/custom/themes/multiline
fi
if [[ ! -d "./homedir/.zsh/completion" ]]; then
mkdir -p ./homedir/.zsh/completion
running "setting docker-ce auto complete"
curl -Ls https://raw.githubusercontent.com/docker/docker-ce/master/components/cli/contrib/completion/zsh/_docker > ./homedir/.zsh/completion/_docker
ok
running "setting docker-compose auto complete"
curl -Ls https://raw.githubusercontent.com/docker/compose/master/contrib/completion/zsh/_docker-compose > ./homedir/.zsh/completion/_docker-compose
ok
running "setting docker-machine auto complete"
curl -Ls https://raw.githubusercontent.com/docker/machine/master/contrib/completion/zsh/_docker-machine > ./homedir/.zsh/completion/_docker-machine
ok
fi
bot "creating symlinks for project dotfiles..."
pushd homedir > /dev/null 2>&1
now=$(date +"%Y.%m.%d.%H.%M.%S")
for file in .*; do
if [[ $file == "." || $file == ".." ]]; then
continue
fi
running "~/$file"
# if the file exists:
if [[ -e ~/$file ]]; then
mkdir -p ~/.dotfiles_backup/$now
mv ~/$file ~/.dotfiles_backup/$now/$file
echo "backup saved as ~/.dotfiles_backup/$now/$file"
fi
# symlink might still exist
unlink ~/$file > /dev/null 2>&1
# create the link
ln -s ~/.dotfiles/homedir/$file ~/$file
ok
done
popd > /dev/null 2>&1
if [[ -d "/Library/Ruby/Gems/2.3.0" ]]; then
running "Fixing Ruby Gems Directory Permissions"
sudo chown -R $(whoami) /Library/Ruby/Gems/2.3.0
ok
fi
bot "installing vim plugins"
read -r -p "are you install plugin? [y|N] " response
if [[ $response =~ ^(y|yes|Y) ]];then
action "installing plugin"
vim +PluginInstall +qall > /dev/null 2>&1
else
echo "skipping..."
fi
bot "installing npm tools needed to run this project..."
require_nvm stable
npm config set save-exact true
npm install
ok
bot "installing formulas, casks, gems, packages, npms"
read -r -p "do you want to installing packages from config.js? [y|N] " response
if [[ $response =~ ^(y|yes|Y) ]];then
action "installing config.js"
node index.js
ok
action "cleanup homebrew"
brew cleanup > /dev/null 2>&1
ok
else
echo "skipping..."
fi
code_bin=$(which code) 2>&1 > /dev/null
if [[ $? == 0 ]]; then
bot "installing visual studio code"
read -r -p "do you want to installing config? [y|N] " response
if [[ $response =~ ^(y|yes|Y) ]];then
action "installing visual studio code config"
curl -Ls "https://gist.github.com/leejongyoung/2d1b541dde9d27d8746e2244551cfcd5/raw/setup_vscode.sh" | sh
if [[ $? != 0 ]]; then
error "unable to install visual studio code plugin, script $0 abort!"
exit 2
fi
ok
else
echo "skipping..."
fi
fi
###############################################################################
bot "Configuring General System UI/UX..."
###############################################################################
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
running "closing any system preferences to prevent issues with automated changes"
osascript -e 'tell application "System Preferences" to quit'
ok
running "Use light menu bar and dock"
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleInterfaceTheme -string "Light"
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleInterfaceStyle -string "Light"
ok
##############################################################################
# Security #
##############################################################################
# Based on:
# https://github.com/drduh/macOS-Security-and-Privacy-Guide
# running "Enable firewall"
# Possible values:
# 0 = off
# 1 = on for specific sevices
# 2 = on for essential services
# sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
# ok
# running "Enable firewall stealth mode (no response to ICMP / ping requests)"
# Source: http://osxdaily.com/2015/11/18/enable-stealth-mode-mac-os-x-firewall
# sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -int 1
# ok
running "Allow untrusted apps to run"
sudo spctl --master-disable
ok
# running "Enable firewall logging"
# sudo defaults write /Library/Preferences/com.apple.alf loggingenabled -int 1
# ok
# running "Do not automatically allow signed software to receive incoming connections"
# sudo defaults write /Library/Preferences/com.apple.alf allowsignedenabled -bool false
# ok
# running "Log firewall events for 90 days"
# sudo perl -p -i -e 's/rotate=seq compress file_max=5M all_max=50M/rotate=utc compress file_max=5M ttl=90/g' "/etc/asl.conf"
# sudo perl -p -i -e 's/appfirewall.log file_max=5M all_max=50M/appfirewall.log rotate=utc compress file_max=5M ttl=90/g' "/etc/asl.conf"
# ok
# running "Reload the firewall"
# (uncomment if above is not commented out)
# launchctl unload /System/Library/LaunchAgents/com.apple.alf.useragent.plist
# sudo launchctl unload /System/Library/LaunchDaemons/com.apple.alf.agent.plist
# sudo launchctl load /System/Library/LaunchDaemons/com.apple.alf.agent.plist
# launchctl load /System/Library/LaunchAgents/com.apple.alf.useragent.plist
# ok
# running "Disable IR remote control"
# sudo defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool false
# ok
# running "Turn Bluetooth off completely"
# sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0
# sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
# sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist
# ok
# running "Disable wifi captive portal"
# sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false
# ok
# running "Disable remote apple events"
# sudo systemsetup -setremoteappleevents off
# ok
# running "Enable remote login"
# sudo systemsetup -setremotelogin on
# ok
# running "Disable wake-on modem"
# sudo systemsetup -setwakeonmodem off
# ok
# running "Disable wake-on LAN"
# sudo systemsetup -setwakeonnetworkaccess off
# ok
# running "Disable file-sharing via AFP or SMB"
# sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
# sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist
# ok
# running "Display login window as name and password"
# sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool true
# ok
# running "Do not show password hints"
# sudo defaults write /Library/Preferences/com.apple.loginwindow RetriesUntilHint -int 0
# ok
# running "Disable guest account login"
# sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool false
# ok
# running "Automatically lock the login keychain for inactivity after 6 hours"
# security set-keychain-settings -t 21600 -l ~/Library/Keychains/login.keychain
# ok
# running "Destroy FileVault key when going into standby mode, forcing a re-auth"
# Source: https://web.archive.org/web/20160114141929/http://training.apple.com/pdf/WP_FileVault2.pdf
# sudo pmset destroyfvkeyonstandby 1
# ok
# running "Disable Bonjour multicast advertisements"
# sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool true
# ok
# running "Disable the crash reporter"
# defaults write com.apple.CrashReporter DialogType -string "none"
# ok
# running "Disable diagnostic reports"
# sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.SubmitDiagInfo.plist
# ok
# running "Log authentication events for 90 days"
# sudo perl -p -i -e 's/rotate=seq file_max=5M all_max=20M/rotate=utc file_max=5M ttl=90/g' "/etc/asl/com.apple.authd"
# ok
# running "Log installation events for a year"
# sudo perl -p -i -e 's/format=bsd/format=bsd mode=0640 rotate=utc compress file_max=5M ttl=365/g' "/etc/asl/com.apple.install"
# ok
# running "Increase the retention time for system.log and secure.log"
# sudo perl -p -i -e 's/\/var\/log\/wtmp.*$/\/var\/log\/wtmp \t\t\t640\ \ 31\ *\t\@hh24\ \J/g' "/etc/newsyslog.conf"
# ok
# running "Keep a log of kernel events for 30 days"
# sudo perl -p -i -e 's|flags:lo,aa|flags:lo,aa,ad,fd,fm,-all,^-fa,^-fc,^-cl|g' /private/etc/security/audit_control
# sudo perl -p -i -e 's|filesz:2M|filesz:10M|g' /private/etc/security/audit_control
# sudo perl -p -i -e 's|expire-after:10M|expire-after: 30d |g' /private/etc/security/audit_control
# ok
# running "Disable the “Are you sure you want to open this application?” dialog"
# defaults write com.apple.LaunchServices LSQuarantine -bool false
# ok
###############################################################################
# SSD-specific tweaks #
###############################################################################
# running "Disable hibernation (speeds up entering sleep mode)"
# sudo pmset -a hibernatemode 0
# ok
# running "Remove the sleep image file to save disk space"
# sudo rm -rf /Private/var/vm/sleepimage
# ok
# running "Create a zero-byte file instead"
# sudo touch /Private/var/vm/sleepimage
# ok
# running "…and make sure it can’t be rewritten"
# sudo chflags uchg /Private/var/vm/sleepimage
# ok
# running "Disable the sudden motion sensor as it’s not useful for SSD"
# sudo pmset -a sms 0
# ok
################################################
# Optional / Experimental #
################################################
# running "Set computer name (as done via System Preferences → Sharing)"
# sudo scutil --set ComputerName "$USER-macbookpro"
# sudo scutil --set HostName "$USER-macbookpro"
# sudo scutil --set LocalHostName "$USER-macbookpro"
# sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$USER-macbookpro"
# ok
# running "Disable smooth scrolling"
# (Uncomment if you’re on an older Mac that messes up the animation)
# defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false
# ok
# running "Disable Resume system-wide"
# defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
# ok
# TODO: might want to enable this again and set specific apps that this works great for
# defaults write com.microsoft.word NSQuitAlwaysKeepsWindows -bool true
# ok
# running "Fix for the ancient UTF-8 bug in QuickLook (http://mths.be/bbo)""
# # Commented out, as this is known to cause problems in various Adobe apps :(
# # See https://github.com/mathiasbynens/dotfiles/issues/237
# echo "0x08000100:0" > ~/.CFUserTextEncoding
# ok
# running "Stop iTunes from responding to the keyboard media keys"
# launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null
# ok
# running "Show icons for hard drives, servers, and removable media on the desktop"
# defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
# defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
# defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
# defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# ok
# running "Enable the MacBook Air SuperDrive on any Mac"
# sudo nvram boot-args="mbasd=1"
# ok
# running "Remove Dropbox’s green checkmark icons in Finder"
# file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns
# [ -e "${file}" ] && mv -f "${file}" "${file}.bak"
# ok
running "Wipe all (default) app icons from the Dock"
# This is only really useful when setting up a new Mac, or if you don’t use
# the Dock to launch apps.
defaults write com.apple.dock persistent-apps -array ""
ok
# running "Enable the 2D Dock"
# defaults write com.apple.dock no-glass -bool true
# ok
# running "Disable the Launchpad gesture (pinch with thumb and three fingers)"
# defaults write com.apple.dock showLaunchpadGestureEnabled -int 0
# ok
running "Add a spacer to the left side of the Dock (where the applications are)"
# defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Mail.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Calendar.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Notes.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Utilities/Terminal.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>';ok
ok
# running "Add a spacer to the right side of the Dock (where the Trash is)"
# defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'
# ok
################################################
bot "Standard System Changes"
################################################
# running "always boot in verbose mode (not MacOS GUI mode)"
# sudo nvram boot-args="-v"
# ok
# running "allow 'locate' command"
# sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist > /dev/null 2>&1
# ok
# running "Set standby delay to 3 hours (default is 1 hour)"
# sudo pmset -a standbydelay 10800
# ok
# running "Disable the sound effects on boot"
# sudo nvram SystemAudioVolume=" "
# ok
# running "Menu bar: disable transparency"
# defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false
# ok
# running "Menu bar: hide the Time Machine, Volume, User, and Bluetooth icons"
# for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do
# defaults write "${domain}" dontAutoLoad -array \
# "/System/Library/CoreServices/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"
# ok
running "Menu bar: show the Time Machine, Volume, User, and Bluetooth icons"
defaults write com.apple.systemuiserver menuExtras -array \
"/System/Library/CoreServices/Menu Extras/Volume.menu" \
"/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
"/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \
"/System/Library/CoreServices/Menu Extras/Clock.menu" \
"/System/Library/CoreServices/Menu Extras/User.menu" \
"/System/Library/CoreServices/Menu Extras/Battery.menu" \
"/System/Library/CoreServices/Menu Extras/AirPort.menu"
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.volume" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.bluetooth" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.timemachine" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.clock" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.user" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.battery" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.airport" -bool true;ok
# running "Set highlight color to green"
# defaults write NSGlobalDomain AppleHighlightColor -string "0.764700 0.976500 0.568600"
# ok
running "Set sidebar icon size to medium"
# Possible values: `small: 1`, `medium: 2`, `large: 3`
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
ok
# running "Always show scrollbars"
# Possible values: `WhenScrolling`, `Automatic` and `Always`
# defaults write NSGlobalDomain AppleShowScrollBars -string "Always"
# ok
# running "Increase window resize speed for Cocoa applications"
# defaults write NSGlobalDomain NSWindowResizeTime -float 0.001
# ok
running "Expand save panel by default"
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
ok
running "Expand print panel by default"
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
ok
# running "Save to iCloud (not to Disk) by default"
# defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool true
# ok
# running "Automatically quit printer app once the print jobs complete"
# defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# ok
# running "Remove duplicates in the “Open With” menu (also see 'lscleanup' alias)"
# /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
# ok
# running "Display ASCII control characters using caret notation in standard text views"
# Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt`
# defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true
# ok
# running "Disable automatic termination of inactive apps"
# defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true
# ok
# running "Disable the crash reporter"
# defaults write com.apple.CrashReporter DialogType -string "none"
# ok
# running "Set Help Viewer windows to non-floating mode"
# defaults write com.apple.helpviewer DevMode -bool true
# ok
# running "Reveal IP, hostname, OS, etc. when clicking clock in login window"
# sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
# ok
# running "Restart automatically if the computer freezes"
# sudo systemsetup -setrestartfreeze on
# ok
# running "Never go into computer sleep mode"
# sudo systemsetup -setcomputersleep Off > /dev/null
# ok
# running "Check for software updates daily, not just once per week"
# defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
# ok
# running "Disable Notification Center and remove the menu bar icon"
# launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist > /dev/null 2>&1
# ok
# running "Disable smart quotes as they’re annoying when typing code"
# defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# ok
# running "Disable smart dashes as they’re annoying when typing code"
# defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# ok
###############################################################################
bot "Configuring Energy Saver..."
###############################################################################
running "Show Battery Percentage on the meny bar"
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
ok
running "Battery - Turn display off after: 1 hour"
sudo pmset -b displaysleep 60
ok
running "Power Adapter - Turn display off after: 3 hour"
sudo pmset -c displaysleep 180
ok
###############################################################################
bot "Trackpad, mouse, keyboard, Bluetooth accessories, and input"
###############################################################################
running "Trackpad: enable tap to click for this user and for the login screen"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
ok
running "Activate App Exposé gesture"
defaults write com.apple.dock showAppExposeGestureEnabled -bool true
ok
# running "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
# ok
# running "Disable 'natural' (Lion-style) scrolling"
# defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
# ok
# running "Increase sound quality for Bluetooth headphones/headsets"
# defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# ok
running "Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs)"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
ok
running "Turn keyboard backlight off after 30 secs of inactivity"
defaults write com.apple.BezelServices kDimTime -int 30
ok
# running "Use scroll gesture with the Ctrl (^) modifier key to zoom"
# defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
# defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# ok
# running "Follow the keyboard focus while zoomed in"
# defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
# ok
running "Disable press-and-hold for keys in favor of key repeat"
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
ok
running "Set a blazingly fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
ok
running "Set language and text formats (english/US)"
defaults write NSGlobalDomain AppleLanguages -array "en"
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
ok
running "Disable auto-correct"
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
ok
running "Disable Touch bar typing suggestions"
defaults write NSGlobalDomain NSAutomaticTextCompletionEnabled -bool false
ok
running "Disable Add period with double-space"
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
ok
running "Disable Capitalize words automatically"
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
ok
###############################################################################
bot "Configuring the Screen"
###############################################################################
running "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
ok
# running "Save screenshots to the downloads"
# defaults write com.apple.screencapture location -string "${HOME}/Downloads/screenshot"
# ok
running "Start screensaver after 1 minutes"
defaults -currentHost write com.apple.screensaver idleTime 60
ok
running "Hide screen saver with clock"
defaults -currentHost write com.apple.screensaver showClock -bool false
ok
running "Show date on the menu bar"
defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM HH:mm:ss"
ok
# running "Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)"
# defaults write com.apple.screencapture type -string "png"
# ok
# running "Disable shadow in screenshots"
# defaults write com.apple.screencapture disable-shadow -bool true
# ok
# running "Enable subpixel font rendering on non-Apple LCDs"
# defaults write NSGlobalDomain AppleFontSmoothing -int 2
# ok
# running "Enable HiDPI display modes (requires restart)"
# sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
# ok
###############################################################################
bot "Finder Configs"
###############################################################################
# running "Keep folders on top when sorting by name (Sierra over)"
# defaults write com.apple.finder _FXSortFoldersFirst -bool true
# ok
# running "Allow quitting via ⌘ + Q; doing so will also hide desktop icons"
# defaults write com.apple.finder QuitMenuItem -bool true
# ok
# running "Disable window animations and Get Info animations"
# defaults write com.apple.finder DisableAllAnimations -bool true
# ok
# running "Set Desktop as the default location for new Finder windows"
# For other paths, use 'PfLo' and 'file:///full/path/here/'
# defaults write com.apple.finder NewWindowTarget -string "PfDe"
# defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
# ok
# running "Show hidden files by default"
# defaults write com.apple.finder AppleShowAllFiles -bool true
# ok
# running "Show all filename extensions"
# defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# ok
# running "Show status bar"
# defaults write com.apple.finder ShowStatusBar -bool true
# ok
# running "Show path bar"
# defaults write com.apple.finder ShowPathbar -bool true
# ok
# running "Allow text selection in Quick Look"
# defaults write com.apple.finder QLEnableTextSelection -bool true
# ok
# running "Display full POSIX path as Finder window title"
# defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# ok
# running "When performing a search, search the current folder by default"
# defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# ok
# running "Disable the warning when changing a file extension"
# defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# ok
# running "Enable spring loading for directories"
# defaults write NSGlobalDomain com.apple.springing.enabled -bool true
# ok
# running "Remove the spring loading delay for directories"
# defaults write NSGlobalDomain com.apple.springing.delay -float 0
# ok
# running "Avoid creating .DS_Store files on network volumes"
# defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# ok
# running "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
# ok
# running "Automatically open a new Finder window when a volume is mounted"
# defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
# defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
# defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
# ok
# running "Use list view in all Finder windows by default"
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
# defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# ok
# running "Disable the warning before emptying the Trash"
# defaults write com.apple.finder WarnOnEmptyTrash -bool false
# ok
# running "Empty Trash securely by default"
# defaults write com.apple.finder EmptyTrashSecurely -bool true
# ok
# running "Enable AirDrop over Ethernet and on unsupported Macs running Lion"
# defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# ok
# running "Show the ~/Library folder"
# chflags nohidden ~/Library
# ok
# running "Expand the following File Info panes: 'General', 'Open with', and 'Sharing & Permissions'"
# defaults write com.apple.finder FXInfoPanesExpanded -dict \
# General -bool true \
# OpenWith -bool true \
# Privileges -bool true
# ok
###############################################################################
bot "Dock & Dashboard"
###############################################################################
# running "Enable highlight hover effect for the grid view of a stack (Dock)"
# defaults write com.apple.dock mouse-over-hilite-stack -bool true
# ok
running "Change dock position on the screen to left"
defaults write com.apple.dock orientation -string left
ok
running "Set the icon size of Dock items to 34 pixels"
defaults write com.apple.dock tilesize -int 34
ok
running "Change minimize/maximize window effect to scale"
defaults write com.apple.dock mineffect -string "scale"
ok
running "Minimize windows into their application’s icon"
defaults write com.apple.dock minimize-to-application -bool true
ok
running "Trun off magnification"
defaults write com.apple.dock magnification -boolean NO
ok
running "Trun off recent excute apps"
defaults write com.apple.dock show-recents -bool true
ok
# running "Enable spring loading for all Dock items"
# defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# ok
# running "Show indicator lights for open applications in the Dock"
# defaults write com.apple.dock show-process-indicators -bool true
# ok
# running "Don’t animate opening applications from the Dock"
# defaults write com.apple.dock launchanim -bool false
# ok
running "Speed up Mission Control animations"
defaults write com.apple.dock expose-animation-duration -float 0.1
ok
# running "Don’t group windows by application in Mission Control"
# # (i.e. use the old Exposé behavior instead)
# defaults write com.apple.dock expose-group-by-app -bool false
# ok
running "Disable Dashboard"
defaults write com.apple.dashboard mcx-disabled -bool true
ok
# running "Don’t show Dashboard as a Space"
# defaults write com.apple.dock dashboard-in-overlay -bool true
# ok
# running "Don’t automatically rearrange Spaces based on most recent use"
# defaults write com.apple.dock mru-spaces -bool false
# ok
running "Remove the auto-hiding Dock delay"
defaults write com.apple.dock autohide-delay -float 0
ok
running "Remove the animation when hiding/showing the Dock"
defaults write com.apple.dock autohide-time-modifier -float 0
ok
running "Automatically hide and show the Dock"
defaults write com.apple.dock autohide -bool true
ok
running "Make Dock icons of hidden applications translucent"
defaults write com.apple.dock showhidden -bool true
ok
# running "Make Dock more transparent"
# defaults write com.apple.dock hide-mirror -bool true
# ok
# running "Reset Launchpad, but keep the desktop wallpaper intact"
# find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete
# ok
###############################################################################
# bot "Configuring Hot Corners"
###############################################################################
# Possible values:
# 0: no-op
# 2: Mission Control
# 3: Show application windows
# 4: Desktop
# 5: Start screen saver
# 6: Disable screen saver
# 7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# running "Top left screen corner → Mission Control"
# defaults write com.apple.dock wvous-tl-corner -int 2
# defaults write com.apple.dock wvous-tl-modifier -int 0
# ok
# running "Top right screen corner → Desktop"
# defaults write com.apple.dock wvous-tr-corner -int 4
# defaults write com.apple.dock wvous-tr-modifier -int 0
# ok
# running "Bottom right screen corner → Start screen saver"
# defaults write com.apple.dock wvous-br-corner -int 5
# defaults write com.apple.dock wvous-br-modifier -int 0
# ok
###############################################################################
bot "Configuring Safari & WebKit"
###############################################################################
# running "Set Safari’s home page to ‘about:blank’ for faster loading"
# defaults write com.apple.Safari HomePage -string "about:blank"
# ok
# running "Prevent Safari from opening ‘safe’ files automatically after downloading"
# defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# ok
# running "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
# ok
# running "Hide Safari’s bookmarks bar by default"
# defaults write com.apple.Safari ShowFavoritesBar -bool false
# ok
# running "Hide Safari’s sidebar in Top Sites"
# defaults write com.apple.Safari ShowSidebarInTopSites -bool false
# ok
# running "Disable Safari’s thumbnail cache for History and Top Sites"
# defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# ok
# running "Enable Safari’s debug menu"
# defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
# ok
# running "Make Safari’s search banners default to Contains instead of Starts With"
# defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# ok
# running "Remove useless icons from Safari’s bookmarks bar"
# defaults write com.apple.Safari ProxiesInBookmarksBar "()"
# ok
# running "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
# ok
# running "Add a context menu item for showing the Web Inspector in web views"
# defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
# ok
###############################################################################
# bot "Configuring Mail"
###############################################################################
# running "Disable send and reply animations in Mail.app"
# defaults write com.apple.mail DisableReplyAnimations -bool true
# defaults write com.apple.mail DisableSendAnimations -bool true
# ok
# running "Copy email addresses as 'foo@example.com' instead of 'Foo Bar <foo@example.com>' in Mail.app"
# defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
# ok
# running "Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app"
# defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9"
# ok
# running "Display emails in threaded mode, sorted by date (oldest at the top)"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes"
# defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date"
# ok
# running "Disable inline attachments (just show the icons)"
# defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
# ok
# running "Disable automatic spell checking"
# defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled"
# ok
###############################################################################
# bot "Spotlight"
###############################################################################
# running "Hide Spotlight tray-icon (and subsequent helper)"
# sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search;ok
# running "Disable Spotlight indexing for any volume that gets mounted and has not yet been indexed"
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
# sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
# ok
# running "Change indexing order and disable some file types from being indexed"
# defaults write com.apple.spotlight orderedItems -array \
# '{"enabled" = 1;"name" = "APPLICATIONS";}' \
# '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
# '{"enabled" = 1;"name" = "DIRECTORIES";}' \
# '{"enabled" = 1;"name" = "PDF";}' \
# '{"enabled" = 1;"name" = "FONTS";}' \
# '{"enabled" = 0;"name" = "DOCUMENTS";}' \
# '{"enabled" = 0;"name" = "MESSAGES";}' \
# '{"enabled" = 0;"name" = "CONTACT";}' \
# '{"enabled" = 0;"name" = "EVENT_TODO";}' \
# '{"enabled" = 0;"name" = "IMAGES";}' \
# '{"enabled" = 0;"name" = "BOOKMARKS";}' \
# '{"enabled" = 0;"name" = "MUSIC";}' \
# '{"enabled" = 0;"name" = "MOVIES";}' \
# '{"enabled" = 0;"name" = "PRESENTATIONS";}' \
# '{"enabled" = 0;"name" = "SPREADSHEETS";}' \
# '{"enabled" = 0;"name" = "SOURCE";}'
# ok
# running "Load new settings before rebuilding the index"
# killall mds > /dev/null 2>&1
# ok
# running "Make sure indexing is enabled for the main volume"
# sudo mdutil -i on / > /dev/null
# ok
# running "Rebuild the index from scratch"
# sudo mdutil -E / > /dev/null
# ok
###############################################################################
# bot "Terminal & iTerm2"
###############################################################################
# running "Only use UTF-8 in Terminal.app"
# defaults write com.apple.terminal StringEncodings -array 4
# ok
# running "Use a modified version of the Solarized Dark theme by default in Terminal.app"
# TERM_PROFILE='Solarized Dark xterm-256color';
# CURRENT_PROFILE="$(defaults read com.apple.terminal 'Default Window Settings')";
# if [ "${CURRENT_PROFILE}" != "${TERM_PROFILE}" ]; then
# open "./configs/${TERM_PROFILE}.terminal";
# sleep 1; # Wait a bit to make sure the theme is loaded
# defaults write com.apple.terminal 'Default Window Settings' -string "${TERM_PROFILE}";
# defaults write com.apple.terminal 'Startup Window Settings' -string "${TERM_PROFILE}";
# fi
# ok
# running "Enable “focus follows mouse” for Terminal.app and all X11 apps"
# i.e. hover over a window and start `typing in it without clicking first
# defaults write com.apple.terminal FocusFollowsMouse -bool true
# defaults write org.x.X11 wm_ffm -bool true
# ok
# running "Installing the Solarized Light theme for iTerm (opening file)"
# open "./configs/Solarized Light.itermcolors"
# ok
# running "Installing the Patched Solarized Dark theme for iTerm (opening file)"
# open "./configs/Solarized Dark Patch.itermcolors"
# ok
# running "Don’t display the annoying prompt when quitting iTerm"
# defaults write com.googlecode.iterm2 PromptOnQuit -bool false
# ok
# running "hide tab title bars"
# defaults write com.googlecode.iterm2 HideTab -bool true
# ok
# running "set system-wide hotkey to show/hide iterm with ^\`"
# defaults write com.googlecode.iterm2 Hotkey -bool true
# ok
# running "hide pane titles in split panes"
# defaults write com.googlecode.iterm2 ShowPaneTitles -bool false
# ok
# running "animate split-terminal dimming"
# defaults write com.googlecode.iterm2 AnimateDimming -bool true
# ok
# defaults write com.googlecode.iterm2 HotkeyChar -int 96;
# defaults write com.googlecode.iterm2 HotkeyCode -int 50;
# defaults write com.googlecode.iterm2 FocusFollowsMouse -int 1;
# defaults write com.googlecode.iterm2 HotkeyModifiers -int 262401;
# running "Make iTerm2 load new tabs in the same directory"
# /usr/libexec/PlistBuddy -c "set \"New Bookmarks\":0:\"Custom Directory\" Recycle" ~/Library/Preferences/com.googlecode.iterm2.plist
# ok
# running "setting fonts"
# defaults write com.googlecode.iterm2 "Normal Font" -string "Hack-Regular 12";
# defaults write com.googlecode.iterm2 "Non Ascii Font" -string "RobotoMonoForPowerline-Regular 12";
# ok
# running "reading iterm settings"
# defaults read -app iTerm > /dev/null 2>&1;
# ok
###############################################################################
bot "Time Machine"
###############################################################################
# running "Prevent Time Machine from prompting to use new hard drives as backup volume"
# defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# ok
# running "Disable local Time Machine backups"
# sudo tmutil disablelocal
# ok
###############################################################################
bot "Activity Monitor"
###############################################################################
# running "Show the main window when launching Activity Monitor"
# defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
# ok
# running "Visualize CPU usage in the Activity Monitor Dock icon"
# defaults write com.apple.ActivityMonitor IconType -int 5
# ok
# running "Show all processes in Activity Monitor"
# defaults write com.apple.ActivityMonitor ShowCategory -int 0
# ok
# running "Sort Activity Monitor results by CPU usage"
# defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
# defaults write com.apple.ActivityMonitor SortDirection -int 0
# ok
###############################################################################
bot "Address Book, Dashboard, iCal, TextEdit, and Disk Utility"
###############################################################################
# running "Enable the debug menu in Address Book"
# defaults write com.apple.addressbook ABShowDebugMenu -bool true
# ok
# running "Enable Dashboard dev mode (allows keeping widgets on the desktop)"
# defaults write com.apple.dashboard devmode -bool true
# ok
# running "Use plain text mode for new TextEdit documents"
# defaults write com.apple.TextEdit RichText -int 0
# ok
# running "Open and save files as UTF-8 in TextEdit"
# defaults write com.apple.TextEdit PlainTextEncoding -int 4
# defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
# ok
# running "Enable the debug menu in Disk Utility"
# defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
# defaults write com.apple.DiskUtility advanced-image-options -bool true
# ok
###############################################################################
# bot "Mac App Store"
###############################################################################
# running "Enable the WebKit Developer Tools in the Mac App Store"
# defaults write com.apple.appstore WebKitDeveloperExtras -bool true
# ok
# running "Enable Debug Menu in the Mac App Store"
# defaults write com.apple.appstore ShowDebugMenu -bool true
# ok
###############################################################################
# bot "Messages"
###############################################################################
# running "Disable automatic emoji substitution (i.e. use plain text smileys)"
# defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false
# ok
# running "Disable smart quotes as it’s annoying for messages that contain code"
# defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
# ok
# running "Disable continuous spell checking"
# defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false
# ok
###############################################################################
# Kill affected applications #
###############################################################################
bot "OK. Note that some of these changes require a logout/restart to take effect. Killing affected applications (so they can reboot)...."
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
"Dock" "Finder" "Mail" "Messages" "Safari" "SizeUp" "SystemUIServer" \
"iCal" "Terminal"; do
killall "${app}" > /dev/null 2>&1
done
bot "Woot! All done. Please restart system"
#!/usr/bin/env bash
# macOS.sh
# Script to set up a new mac with my preferred configurations.
#
# Original code and idea from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.macos
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
osascript -e 'tell application "System Preferences" to quit'
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
###############################################################################
# Updates #
###############################################################################
# search for system updates and install them
# softwareupdate --install --all
###############################################################################
# General #
###############################################################################
echo "Configuring general preferences"
# Use dark menu bar and dock
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleInterfaceTheme -string "Light"
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleInterfaceStyle -string "Light"
# Set sidebar icon size to small
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2
###############################################################################
# Desktop & Screen Saver #
###############################################################################
echo "Configuring desktop and screen saver preferences"
# Change screensaver to random
defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName Random path /System/Library/Screen\ Savers/Random.saver type 8
# Start screensaver after 10 minutes
defaults -currentHost write com.apple.screensaver idleTime 60
# Show screensaver with Clock
defaults -currentHost write com.apple.screensaver showClock -bool false
# Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and
# all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`.
# rm -rf ~/Library/Application Support/Dock/desktoppicture.db
# sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg
# sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg
###############################################################################
# Dock #
###############################################################################
echo "Configuring dock preferences"
# Set the icon size of Dock items to 34 pixels
defaults write com.apple.dock tilesize -int 34
# Change minimize/maximize window effect to Scale effect
defaults write com.apple.dock mineffect -string "scale"
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Make Dock icons of hidden applications translucent
defaults write com.apple.dock showhidden -bool true
# Change dock position on the screen to left
defaults write com.apple.dock orientation -string left
# Turn off magnification
defaults write com.apple.dock magnification -boolean NO
# Double-click a window's title bar to minimize
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleActionOnDoubleClick -string "Minimize"
# Prefer tabs when opening documents always
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleWindowTabbingMode -string "always"
# remove all icons from the dock
defaults write com.apple.dock persistent-apps -array
# add my preferred icons to the dock
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Mail.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Calendar.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Notes.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Utilities/Terminal.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
###############################################################################
# Mission Control #
###############################################################################
echo "Configuring mission control preferences"
# Don’t automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
# Don’t group windows by application in Mission Control
defaults write com.apple.dock expose-group-by-app -bool false
# Disable Dashboard → disabled by default
# defaults write com.apple.dashboard mcx-disabled -bool true
# Hot Corners... Top left screen corner → Mission Control
defaults write com.apple.dock wvous-tl-corner -int 2
defaults write com.apple.dock wvous-tl-modifier -int 0
###############################################################################
# Language & Region #
###############################################################################
echo "Configuring language and region preferences"
# System language set to English, region set to ES
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleLocale -string "en_US"
# Select default metrics
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -bool true
defaults write NSGlobalDomain AppleTemperatureUnit -string "Celsius"
###############################################################################
# Security & Privacy #
###############################################################################
echo "Configuring security and privacy preferences"
# 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
# Turn on firewall
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
###############################################################################
# Spotlight #
###############################################################################
echo "Configuring spotlight preferences"
# Change default spotlight categories
defaults write com.apple.spotlight orderedItems -array \
'{"enabled" = 1;"name" = "APPLICATIONS";}' \
'{"enabled" = 1;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' \
'{"enabled" = 1;"name" = "MENU_CONVERSION";}' \
'{"enabled" = 1;"name" = "MENU_EXPRESSION";}' \
'{"enabled" = 1;"name" = "MENU_DEFINITION";}' \
'{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
'{"enabled" = 1;"name" = "DOCUMENTS";}' \
'{"enabled" = 1;"name" = "DIRECTORIES";}' \
'{"enabled" = 1;"name" = "PRESENTATIONS";}' \
'{"enabled" = 1;"name" = "SPREADSHEETS";}' \
'{"enabled" = 1;"name" = "PDF";}' \
'{"enabled" = 1;"name" = "MESSAGES";}' \
'{"enabled" = 1;"name" = "CONTACT";}' \
'{"enabled" = 1;"name" = "EVENT_TODO";}' \
'{"enabled" = 1;"name" = "IMAGES";}' \
'{"enabled" = 1;"name" = "BOOKMARKS";}' \
'{"enabled" = 1;"name" = "MUSIC";}' \
'{"enabled" = 1;"name" = "MOVIES";}' \
'{"enabled" = 0;"name" = "FONTS";}' \
'{"enabled" = 1;"name" = "MENU_OTHER";}' \
'{"enabled" = 1;"name" = "SOURCE";}'
###############################################################################
# Displays #
###############################################################################
echo "Configuring displays preferences"
# Don't show mirroring options in menu bar
defaults write com.apple.airplay showInMenuBarIfPresent -bool false
# TODO is it possible to change resolution with a command?
###############################################################################
# Energy Saver #
###############################################################################
echo "Configuring energy saver preferences"
# Show Battery Percentage on the meny bar
defaults write com.apple.menuextra.battery ShowPercent -string "YES"
# Battery - Computer sleep: 20 min
sudo pmset -b sleep 20
# Battery - Turn display off after: 5 min
sudo pmset -b displaysleep 5
# Power Adapter - Computer sleep: 30 min
sudo pmset -c sleep 30
# Power Adapter - Turn display off after: 12 min
sudo pmset -c displaysleep 12
###############################################################################
# Keyboard #
###############################################################################
echo "Configuring keyboard preferences"
# Enable full keyboard access for all controls
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
# Don't adjust keyboard brightness on low light
# defaults write com.apple.BezelServices kDim -bool true
# Turn keyboard backlight off after 30 secs of inactivity
defaults write com.apple.BezelServices kDimTime -int 30
# Disable auto-correct spelling automatically
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Set a fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 10
# Disable press-and-hold for keys in favor of key repeat
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
###############################################################################
# Trackpad #
###############################################################################
echo "Configuring trackpad preferences"
# enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# activate App Exposé gesture
defaults write com.apple.dock showAppExposeGestureEnabled -bool true
###############################################################################
# Printers #
###############################################################################
echo "Configuring printers preferences"
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
###############################################################################
# Sound #
###############################################################################
echo "Configuring sound preferences"
# Show volume in menu bar and hide clock/calendar (I use day-o)
defaults write com.apple.systemuiserver menuExtras -array \
"/System/Library/CoreServices/Menu Extras/Volume.menu" \
"/System/Library/CoreServices/Menu Extras/AirPort.menu" \
"/System/Library/CoreServices/Menu Extras/Battery.menu"
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.volume" -bool true
###############################################################################
# App Store #
###############################################################################
echo "Configuring App Store preferences"
# Save password for free downloads
# TODO
# Enable the WebKit Developer Tools in the Mac App Store
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
# Enable Debug Menu in the Mac App Store
defaults write com.apple.appstore ShowDebugMenu -bool true
# Auto install app updates
sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdate -bool TRUE
# Don’t install automatically macOS updates
sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired -bool FALSE
###############################################################################
# Bluethooth #
###############################################################################
echo "Configuring Bluetooth preferences"
# Turn bluethooth off
# TODO
###############################################################################
# Users & Groups #
###############################################################################
echo "Configuring users and groups preferences"
# Don't allow guests to log in to this computer
# TODO
# sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO
# sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO
# sudo defaults write /Library/Preferences/com.apple.loginwindow.plist GuestEnabled -bool NO
###############################################################################
# Date & Time #
###############################################################################
echo "Configuring date and time preferences"
# Show date on the menu bar
defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM HH:mm"
###############################################################################
# Time Machine #
###############################################################################
echo "Configuring time machine preferences"
# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
###############################################################################
# Accesibility #
###############################################################################
echo "Configuring accesibility preferences"
# Enable trackpad dragging without lock
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Dragging -int 1
defaults write com.apple.AppleMultitouchTrackpad Dragging -int 1
###############################################################################
# Extras #
###############################################################################
echo "Configuring extra preferences"
# Show the ~/Library folder
chflags nohidden ~/Library
# Show the /Volumes folder
sudo chflags nohidden /Volumes
# Create Developer folder in home directory
if [ ! -d ~/Developer ]; then
mkdir ~/Developer
fi;
# Create local database to enable locate/find commands to search on the system
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
###############################################################################
# Desktop #
###############################################################################
echo "Configuring desktop view options"
# Show item info to the right of the icons on the desktop
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist
# Set desktop icons size to 20x20
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 20" ~/Library/Preferences/com.apple.finder.plist
# Set grid spacing for desktop icons to 50
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist
# Set text size to 10pt
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:textSize 10" ~/Library/Preferences/com.apple.finder.plist
###############################################################################
# Finder #
###############################################################################
echo "Configuring finder options"
# Set User home as the default location for new Finder windows
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Keep folders on top when sorting by name
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# Use list view in all Finder windows by default
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Don't show tags on the sidebar
# TODO
# Don't show "All my files" and "Recent tags" on the sidebar
# TODO "all my files"
defaults write com.apple.finder ShowRecentTags -bool false
# Show "User" and "User Macbook Pro" on the sidebar
# TODO
# Show path bar
defaults write com.apple.finder ShowPathbar -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
###############################################################################
# Mail #
###############################################################################
echo "Configuring mail options"
# Show To/Cc label in the message list
defaults write com.apple.mail EnableToCcInMessageList -bool true
# Bold unread messages
defaults write com.apple.mail ShouldShowUnreadMessagesInBold -bool true
# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" "@\U21a9"
# Disable inline attachments (just show the icons)
defaults write com.apple.mail DisableInlineAttachmentViewing -bool true
# Check for new messages automatically
defaults write com.apple.mail PollTime -int -1
# TODO add signature to gmail
# TODO select gmail as primary address
# TODO Enable junk mail filtering
###############################################################################
# Safari #
###############################################################################
echo "Configuring safari options"
# show the status bar at the bottom (see URL on hover)
defaults write com.apple.Safari 'ShowStatusBar' -bool true
# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# Press Tab to highlight each item on a web page
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true
# Show the full URL in the address bar (note: this still hides the scheme)
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
# Set Safari’s home page to google.com
defaults write com.apple.Safari HomePage -string "https://www.google.com"
# Prevent Safari from opening ‘safe’ files automatically after downloading
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# Show Safari’s bookmarks bar by default
defaults write com.apple.Safari ShowFavoritesBar -bool true
defaults write com.apple.Safari ShowFavoritesBar-v2 -bool true
# Enable Safari’s 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
# 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
# Enable “Do Not Track”
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
# Update extensions automatically
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true
# Warn about fraudulent websites
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
# Open new tabs with an empty page
defaults write com.apple.Safari NewTabBehavior -int 1
# don't show favorites on the smart search bar
defaults write com.apple.Safari ShowFavoritesUnderSmartSearchField -bool false
# don't allow websites to ask for permission to send push notifications
defaults write com.apple.Safari CanPromptForPushNotifications -bool false
# include search engine suggestions
defaults write com.apple.Safari SuppressSearchSuggestions -bool false
# TODO install extensions: "Save to Pocket", "AdBlock", "SessionRestore"
###############################################################################
# Calendar #
###############################################################################
echo "Configuring calendar options"
# Don't show birthdays Calendar
defaults write com.apple.iCal "display birthdays calendar" -bool false
# Show week numbers
defaults write com.apple.iCal "Show Week Numbers" -bool true
# Make text smaller
defaults write com.apple.iCal "CalUICanvasOccurrenceFontSize" -int 10
###############################################################################
# Contacts #
###############################################################################
echo "Configuring contacts options"
# Address format
defaults write com.apple.AddressBook ABDefaultAddressCountryCode -string "es"
# Display format "First, Last"
defaults write com.apple.AddressBook NSPersonNameDefaultDisplayNameOrder -int 1
# Sort by first name
defaults write com.apple.AddressBook ABNameSortingFormat -string "sortingFirstName sortingLastName"
###############################################################################
# Terminal #
###############################################################################
echo "Configuring terminal options"
# default theme to Basic
defaults write com.apple.Terminal "Default Window Settings" -string "Basic"
defaults write com.apple.Terminal "Startup Window Settings" -string "Basic"
# configure the basic theme
# /usr/libexec/PlistBuddy -c "Set \"Window Settings\":Basic:FontAntialias 1" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:rowCount integer 30" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:UseBoldFonts bool 1" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowActiveProcessArgumentsInTitle bool 1" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowRepresentedURLPathInTitle bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowTTYNameInTitle bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:BackgroundSettingsForInactiveWindows bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:UseBrightBold bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowWindowSettingsNameInTitle bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowCommandKeyInTitle bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:BackgroundBlur real 0,296188586795261" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:CursorType bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:columnCount integer 90" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowDimensionsInTitle bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:CursorBlink bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowActiveProcessInTitle bool 1" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowShellCommandInTitle bool 0" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:ShowRepresentedURLInTitle bool 1" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Add \"Window Settings\":Basic:BackgroundColor data \"<62706c69 73743030 d4010203 04050615 16582476 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 6f701200 0186a0a3 07080f55 246e756c 6cd3090a 0b0c0d0e 554e5352 47425c4e 53436f6c 6f725370 61636556 24636c61 73734631 20312031 00100180 02d21011 12135a24 636c6173 736e616d 65582463 6c617373 6573574e 53436f6c 6f72a212 14584e53 4f626a65 63745f10 0f4e534b 65796564 41726368 69766572 d1171854 726f6f74 80010811 1a232d32 373b4148 4e5b6269 6b6d727d 868e919a acafb400 00000000 00010100 00000000 00001900 00000000 00000000 00000000 0000b6>\"" ~/Library/Preferences/com.apple.Terminal.plist
# /usr/libexec/PlistBuddy -c "Set \"Window Settings\":Basic:Font data \"<62706c69 73743030 d4010203 04050618 19582476 65727369 6f6e5824 6f626a65 63747359 24617263 68697665 72542474 6f701200 0186a0a4 07081112 55246e75 6c6cd409 0a0b0c0d 0e0f1056 4e535369 7a65584e 5366466c 61677356 4e534e61 6d655624 636c6173 73234026 00000000 00001010 80028003 5e53464d 6f6e6f2d 52656775 6c6172d2 13141516 5a24636c 6173736e 616d6558 24636c61 73736573 564e5346 6f6e74a2 1517584e 534f626a 6563745f 100f4e53 4b657965 64417263 68697665 72d11a1b 54726f6f 74800108 111a232d 32373c42 4b525b62 69727476 78878c97 a0a7aab3 c5c8cd00 00000000 00010100 00000000 00001c00 00000000 00000000 00000000 0000cf>\"" ~/Library/Preferences/com.apple.Terminal.plist
###############################################################################
# Text Edit #
###############################################################################
echo "Configuring text edit options"
# Plain text by default
defaults write com.apple.TextEdit RichText -int 0
# Turn off 'smart' editing
defaults write com.apple.TextEdit SmartDashes -int 0
defaults write com.apple.TextEdit SmartQuotes -int 0
defaults write com.apple.TextEdit TextReplacement -int 0
# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
###############################################################################
# Activity Monitor #
###############################################################################
echo "Configuring activity monitor options"
# Visualize CPU usage in the Activity Monitor Dock icon
defaults write com.apple.ActivityMonitor IconType -int 5
# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
###############################################################################
echo "Done. Note that some of these changes require a logout/restart to take effect."
# Restart computer now!
# sudo shutdown -r now
###############################################################################
bot "Configuring General System UI/UX..."
###############################################################################
# Close any open System Preferences panes, to prevent them from overriding
# settings we’re about to change
running "closing any system preferences to prevent issues with automated changes"
osascript -e 'tell application "System Preferences" to quit';ok
running "Use light menu bar and dock"
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleInterfaceTheme -string "Light"
defaults write ~/Library/Preferences/.GlobalPreferences.plist AppleInterfaceStyle -string "Light";ok
running "Set sidebar icon size to medium"
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2;ok
###############################################################################
bot "Configuring Desktop & Screen Saver..."
###############################################################################
running "Change screensaver to google-features-photos"
#defaults -currentHost write com.apple.screensaver moduleDict -dict moduleName Random path /System/Library/Screen\ Savers/Random.saver type 8;ok
running "Start screensaver after 1 minutes"
defaults -currentHost write com.apple.screensaver idleTime 60;ok
running "Hide screen saver with clock"
defaults -currentHost write com.apple.screensaver showClock -bool false;ok
###############################################################################
bot "Configuring Dock..."
###############################################################################
running "Set the icon size of Dock items to 34 pixels"
defaults write com.apple.dock tilesize -int 34;ok
running "Change minimize/maximize window effect to Scale effect"
defaults write com.apple.dock mineffect -string "scale";ok
running "Automatically hide and show the Dock"
defaults write com.apple.dock autohide -bool true;ok
running "Remove the auto-hiding Dock delay"
defaults write com.apple.dock autohide-delay -float 0;ok
running "Remove the animation when hiding/showing the Dock"
defaults write com.apple.dock autohide-time-modifier -float 0;ok
running "Make Dock icons of hidden applications translucent"
defaults write com.apple.dock showhidden -bool true;ok
running "Minimize windows into their application’s icon"
defaults write com.apple.dock minimize-to-application -bool true;ok
running "Change dock position on the screen to left"
defaults write com.apple.dock orientation -string left;ok
running "Trun off magnification"
defaults write com.apple.dock magnification -boolean NO;ok
running "Trun off recent excute apps"
defaults write com.apple.dock show-recents -bool true;ok
running "Remove all icons from the dock"
defaults write com.apple.dock persistent-apps -array;ok
running "Add my preferred icons to the dock"
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Mail.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Calendar.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Notes.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Utilities/Terminal.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>';ok
###############################################################################
bot "Configuring Mission Control..."
###############################################################################
running "Speed up Mission Control animations"
defaults write com.apple.dock expose-animation-duration -float 0.1;ok
# running "Disable Dashboard"
#defaults write com.apple.dashboard mcx-disabled -bool true;ok
# running "Don’t automatically rearrange Spaces based on most recent use"
#defaults write com.apple.dock mru-spaces -bool false;ok
# running "Don’t show Dashboard as a Space"
#defaults write com.apple.dock dashboard-in-overlay -bool true;ok
# running "Make Dock icons of hidden applications translucent"
#defaults write com.apple.dock showhidden -bool true;ok
# running "Make Dock more transparent"
#defaults write com.apple.dock hide-mirror -bool true;ok
# running "Enable the 2D Dock"
#defaults write com.apple.dock no-glass -bool true;ok
#running "Disable the Launchpad gesture (pinch with thumb and three fingers)"
#defaults write com.apple.dock showLaunchpadGestureEnabled -int 0;ok
#running "Add a spacer to the left side of the Dock (where the applications are)"
#defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}';ok
#running "Add a spacer to the right side of the Dock (where the Trash is)"
#defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}';ok
# running "Enable highlight hover effect for the grid view of a stack (Dock)"
#defaults write com.apple.dock mouse-over-hilite-stack -bool true;ok
# running "Enable spring loading for all Dock items"
#defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true;ok
# running "Show indicator lights for open applications in the Dock"
#defaults write com.apple.dock show-process-indicators -bool true;ok
# running "Don’t animate opening applications from the Dock"
#defaults write com.apple.dock launchanim -bool false;ok
# running "Don’t group windows by application in Mission Control"
# (i.e. use the old Exposé behavior instead)
#defaults write com.apple.dock expose-group-by-app -bool false;ok
###############################################################################
bot "Configuring Hot Corners..."
###############################################################################
# Possible values:
# 0: no-op
# 2: Mission Control
# 3: Show application windows
# 4: Desktop
# 5: Start screen saver
# 6: Disable screen saver
# 7: Dashboard
# 10: Put display to sleep
# 11: Launchpad
# 12: Notification Center
# running "Top left screen corner → Mission Control"
#defaults write com.apple.dock wvous-tl-corner -int 2
#defaults write com.apple.dock wvous-tl-modifier -int 0;ok
# running "Top right screen corner → Desktop"
#defaults write com.apple.dock wvous-tr-corner -int 4
#defaults write com.apple.dock wvous-tr-modifier -int 0;ok
# running "Bottom right screen corner → Start screen saver"
#defaults write com.apple.dock wvous-br-corner -int 5
#defaults write com.apple.dock wvous-br-modifier -int 0;ok
###############################################################################
bot "Configuring Language & region..."
###############################################################################
running "Set language and text formats (english/US)"
defaults write NSGlobalDomain AppleLanguages -array "en";ok
running "Select default metrics"
defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleTemperatureUnit -string "Celsius"
defaults write NSGlobalDomain AppleMetricUnits -bool true;ok
###############################################################################
bot "Configuring Security & Privacy..."
###############################################################################
# Based on:
# https://github.com/drduh/macOS-Security-and-Privacy-Guide
# https://benchmarks.cisecurity.org/tools2/osx/CIS_Apple_OSX_10.12_Benchmark_v1.0.0.pdf
running "Allow untrusted apps to run"
sudo spctl --master-disable;ok
running "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;ok
running "Enable firewall."
# 0 = off
# 1 = on for specific sevices
# 2 = on for essential services
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1;ok
# running "Enable firewall stealth mode (no response to ICMP / ping requests)""
# Source: https://support.apple.com/kb/PH18642
#sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -int 1;ok
# running "Enable firewall logging"
#sudo defaults write /Library/Preferences/com.apple.alf loggingenabled -int 1;ok
# running "Do not automatically allow signed software to receive incoming connections"
#sudo defaults write /Library/Preferences/com.apple.alf allowsignedenabled -bool false;ok
# running "Log firewall events for 90 days"
#sudo perl -p -i -e 's/rotate=seq compress file_max=5M all_max=50M/rotate=utc compress file_max=5M ttl=90/g' "/etc/asl.conf"
#sudo perl -p -i -e 's/appfirewall.log file_max=5M all_max=50M/appfirewall.log rotate=utc compress file_max=5M ttl=90/g' "/etc/asl.conf";ok
# running "Reload the firewall"
# (uncomment if above is not commented out)
#launchctl unload /System/Library/LaunchAgents/com.apple.alf.useragent.plist
#sudo launchctl unload /System/Library/LaunchDaemons/com.apple.alf.agent.plist
#sudo launchctl load /System/Library/LaunchDaemons/com.apple.alf.agent.plist
#launchctl load /System/Library/LaunchAgents/com.apple.alf.useragent.plist;ok
# running "Disable IR remote control"
#sudo defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool false;ok
# running "Turn Bluetooth off completely"
#sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 0
#sudo launchctl unload /System/Library/LaunchDaemons/com.apple.blued.plist
#sudo launchctl load /System/Library/LaunchDaemons/com.apple.blued.plist;ok
# running "Disable wifi captive portal"
#sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.captive.control Active -bool false;ok
# running "Disable remote apple events"
#sudo systemsetup -setremoteappleevents off;ok
# running "Disable remote login"
#sudo systemsetup -setremotelogin off;ok
# running "Disable wake-on modem"
#sudo systemsetup -setwakeonmodem off;ok
# running "Disable wake-on LAN"
#sudo systemsetup -setwakeonnetworkaccess off;ok
# running "Disable file-sharing via AFP or SMB"
#sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
#sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist;ok
# running "Display login window as name and password"
#sudo defaults write /Library/Preferences/com.apple.loginwindow SHOWFULLNAME -bool true;ok
# running "Do not show password hints"
#sudo defaults write /Library/Preferences/com.apple.loginwindow RetriesUntilHint -int 0;ok
# running "Automatically lock the login keychain for inactivity after 6 hours"
#security set-keychain-settings -t 21600 -l ~/Library/Keychains/login.keychain;ok
# running "Destroy FileVault key when going into standby mode, forcing a re-auth."
# Source: https://web.archive.org/web/20160114141929/http://training.apple.com/pdf/WP_FileVault2.pdf
#sudo pmset destroyfvkeyonstandby 1;ok
# running "Disable Bonjour multicast advertisements"
#sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool true;ok
# running "Disable the crash reporter"
#defaults write com.apple.CrashReporter DialogType -string "none";ok
# running "Disable diagnostic reports"
#sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.SubmitDiagInfo.plist;ok
# running "Log authentication events for 90 days"
#sudo perl -p -i -e 's/rotate=seq file_max=5M all_max=20M/rotate=utc file_max=5M ttl=90/g' "/etc/asl/com.apple.authd";ok
# running "Log installation events for a year"
#sudo perl -p -i -e 's/format=bsd/format=bsd mode=0640 rotate=utc compress file_max=5M ttl=365/g' "/etc/asl/com.apple.install";ok
# running "Increase the retention time for system.log and secure.log"
#sudo perl -p -i -e 's/\/var\/log\/wtmp.*$/\/var\/log\/wtmp \t\t\t640\ \ 31\ *\t\@hh24\ \J/g' "/etc/newsyslog.conf";ok
# running "Keep a log of kernel events for 30 days"
#sudo perl -p -i -e 's|flags:lo,aa|flags:lo,aa,ad,fd,fm,-all,^-fa,^-fc,^-cl|g' /private/etc/security/audit_control
#sudo perl -p -i -e 's|filesz:2M|filesz:10M|g' /private/etc/security/audit_control
#sudo perl -p -i -e 's|expire-after:10M|expire-after: 30d |g' /private/etc/security/audit_control;ok
# running "Disable the 'Are you sure you want to open this application?' dialog"
#defaults write com.apple.LaunchServices LSQuarantine -bool false;ok
###############################################################################
bot "Configuring Spotlight..."
###############################################################################
running "Change default spotlight categories"
defaults write com.apple.spotlight orderedItems -array \
'{"enabled" = 1;"name" = "APPLICATIONS";}' \
'{"enabled" = 1;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' \
'{"enabled" = 1;"name" = "MENU_CONVERSION";}' \
'{"enabled" = 1;"name" = "MENU_EXPRESSION";}' \
'{"enabled" = 1;"name" = "MENU_DEFINITION";}' \
'{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
'{"enabled" = 1;"name" = "DOCUMENTS";}' \
'{"enabled" = 1;"name" = "DIRECTORIES";}' \
'{"enabled" = 1;"name" = "PRESENTATIONS";}' \
'{"enabled" = 1;"name" = "SPREADSHEETS";}' \
'{"enabled" = 1;"name" = "PDF";}' \
'{"enabled" = 1;"name" = "MESSAGES";}' \
'{"enabled" = 1;"name" = "CONTACT";}' \
'{"enabled" = 1;"name" = "EVENT_TODO";}' \
'{"enabled" = 1;"name" = "IMAGES";}' \
'{"enabled" = 1;"name" = "BOOKMARKS";}' \
'{"enabled" = 1;"name" = "MUSIC";}' \
'{"enabled" = 1;"name" = "MOVIES";}' \
'{"enabled" = 0;"name" = "FONTS";}' \
'{"enabled" = 1;"name" = "MENU_OTHER";}' \
'{"enabled" = 1;"name" = "SOURCE";}';ok
# running "Hide Spotlight tray-icon (and subsequent helper)"
#sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search;ok
# running "Disable Spotlight indexing for any volume that gets mounted and has not yet been indexed"
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
#sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes";ok
# running "Load new settings before rebuilding the index"
#killall mds > /dev/null 2>&1;ok
# running "Make sure indexing is enabled for the main volume"
#sudo mdutil -i on / > /dev/null;ok
#running "Rebuild the index from scratch"
#sudo mdutil -E / > /dev/null;ok
###############################################################################
# bot "Configuring Displays..."
###############################################################################
# running "Don't show mirroring options in menu bar"
#defaults write com.apple.airplay showInMenuBarIfPresent -bool false
###############################################################################
bot "Configuring Energy Saver..."
###############################################################################
running "Show Battery Percentage on the meny bar"
defaults write com.apple.menuextra.battery ShowPercent -string "YES";ok
# running "Battery - Computer sleep: 1 hour"
#sudo pmset -b sleep 60;ok
running "Battery - Turn display off after: 1 hour"
sudo pmset -b displaysleep 60;ok
# running "Power Adapter - Computer sleep: 1 hour"
#sudo pmset -c sleep 60;ok
running "Power Adapter - Turn display off after: 3 hour"
sudo pmset -c displaysleep 180;ok
###############################################################################
bot "Configuring Keyboard..."
###############################################################################
running "Enable full keyboard access for all controls"
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3;ok
running "Turn keyboard backlight off after 30 secs of inactivity"
defaults write com.apple.BezelServices kDimTime -int 30;ok
running "Disable auto-correct spelling automatically"
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false;ok
running "Disable Touch bar typing suggestions"
defaults write NSGlobalDomain NSAutomaticTextCompletionEnabled -bool false;ok
running "Disable Add period with double-space"
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false;ok
running "Disable Capitalize words automatically"
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false;ok
running "Set a fast keyboard repeat rate"
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15;ok
running "Disable press-and-hold for keys in favor of key repeat"
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false;ok
# running "Don't adjust keyboard brightness on low light"
#defaults write com.apple.BezelServices kDim -bool true;ok
###############################################################################
bot "Configuring Trackpad..."
###############################################################################
running "Enable tap to click for this user and for the login screen"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1;ok
running "Activate App Exposé gesture"
defaults write com.apple.dock showAppExposeGestureEnabled -bool true;ok
###############################################################################
bot "Configuring Printer & Scanners..."
###############################################################################
running "Expand print panel by default"
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true;ok
###############################################################################
bot "Configuring Menubar..."
###############################################################################
running "Menu bar: show the Time Machine, Volume, User, and Bluetooth icons"
defaults write com.apple.systemuiserver menuExtras -array \
"/System/Library/CoreServices/Menu Extras/Volume.menu" \
"/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
"/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \
"/System/Library/CoreServices/Menu Extras/Clock.menu" \
"/System/Library/CoreServices/Menu Extras/User.menu" \
"/System/Library/CoreServices/Menu Extras/Battery.menu" \
"/System/Library/CoreServices/Menu Extras/AirPort.menu"
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.volume" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.bluetooth" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.timemachine" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.clock" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.user" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.battery" -bool true
defaults write com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.airport" -bool true;ok
###############################################################################
bot "Configuring Sharing..."
###############################################################################
running "Set computer name (as done via System Preferences → Sharing)"
sudo scutil --set ComputerName "leejongyoung-macbookpro"
sudo scutil --set HostName "leejongyoung-macbookpro"
sudo scutil --set LocalHostName "leejongyoung-macbookpro"
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "leejongyoung-macbookpro";ok
###############################################################################
bot "Configuring Users & Groups..."
###############################################################################
running "Don't allow guests to log in to this computer"
sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool NO
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool NO
sudo defaults write /Library/Preferences/com.apple.loginwindow.plist GuestEnabled -bool NO;ok
###############################################################################
bot "Configuring Date & Time..."
###############################################################################
running "Show date on the menu bar"
defaults write com.apple.menuextra.clock DateFormat -string "EEE d MMM HH:mm:ss";ok
###############################################################################
# bot "Configuring Time Machine..."
###############################################################################
# running "Prevent Time Machine from prompting to use new hard drives as backup volume"
#defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true;ok
# running "Disable local Time Machine backups"
#hash tmutil &> /dev/null && sudo tmutil disablelocal;ok
###############################################################################
bot "Configuring Accesibility..."
###############################################################################
running "Enable trackpad dragging three finger drag"
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Dragging -int 0
defaults write com.apple.AppleMultitouchTrackpad Dragging -int 0;ok
###############################################################################
bot "Configuring Finder..."
###############################################################################
running "Show the ~/Library folder"
chflags nohidden ~/Library;ok
running "Show the /Volumes folder"
sudo chflags nohidden /Volumes;ok
running "Create Developer folder in home directory"
if [ ! -d ~/Developer ]; then
mkdir ~/Developer
fi;ok
# running "Create local database to enable locate/find commands to search on the system"
#sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist;ok
###############################################################################
bot "Configuring Finder Options..."
###############################################################################
running "Set User home as the default location for new Finder windows"
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/";ok
running "Show all filename extensions"
defaults write NSGlobalDomain AppleShowAllExtensions -bool true;ok
running "When performing a search, search the current folder by default"
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf";ok
running "Keep folders on top when sorting by name"
defaults write com.apple.finder _FXSortFoldersFirst -bool true;ok
running "Use list view in all Finder windows by default"
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv";ok
# running "Don't show tags on the sidebar"
# TODO
running "Don't show Recent tags on the sidebar"
defaults write com.apple.finder ShowRecentTags -bool false;ok
# running "Show User & User Macbook Pro on the sidebar"
# TODO
running "Show path bar"
defaults write com.apple.finder ShowPathbar -bool true;ok
running "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;ok
###############################################################################
bot "Configuring Desktop View Options..."
###############################################################################
running "Show item info to the right of the icons on the desktop"
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist;ok
running "Set desktop icons size to 20x20"
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 20" ~/Library/Preferences/com.apple.finder.plist;ok
running "Set grid spacing for desktop icons to 50"
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist;ok
running "Set text size to 10pt"
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:textSize 10" ~/Library/Preferences/com.apple.finder.plist;ok
###############################################################################
bot "Configuring Text Edit Options..."
###############################################################################
running "Use plain text mode for new TextEdit documents"
defaults write com.apple.TextEdit RichText -int 0;ok
running "Open and save files as UTF-8 in TextEdit"
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4;ok
running "Turn off 'smart' editing"
defaults write com.apple.TextEdit SmartDashes -int 0
defaults write com.apple.TextEdit SmartQuotes -int 0
defaults write com.apple.TextEdit TextReplacement -int 0;ok
###############################################################################
bot "Configuring Activity Monitor Options..."
###############################################################################
running "Visualize CPU usage in the Activity Monitor Dock icon"
defaults write com.apple.ActivityMonitor IconType -int 5;ok
running "Show all processes in Activity Monitor"
defaults write com.apple.ActivityMonitor ShowCategory -int 0;ok
running "Sort Activity Monitor results by CPU usage"
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0;ok
# running "Show the main window when launching Activity Monitor"
#defaults write com.apple.ActivityMonitor OpenMainWindow -bool true;ok
###############################################################################
bot "Configuring Contacts Options..."
###############################################################################
running "Address format"
defaults write com.apple.AddressBook ABDefaultAddressCountryCode -string "es";ok
running "Display format First, Last"
defaults write com.apple.AddressBook NSPersonNameDefaultDisplayNameOrder -int 1;ok
# running "Sort by first name"
defaults write com.apple.AddressBook ABNameSortingFormat -string "sortingFirstName sortingLastName"
###############################################################################
bot "Configuring Calendar Options..."
###############################################################################
running "Don't show birthdays Calendar"
defaults write com.apple.iCal "display birthdays calendar" -bool false;ok
running "Show week numbers"
defaults write com.apple.iCal "Show Week Numbers" -bool true;ok
running "Make text smaller"
defaults write com.apple.iCal "CalUICanvasOccurrenceFontSize" -int 10;ok
###############################################################################
bot "Configuring Safari Options..."
###############################################################################
running "Show the status bar at the bottom (see URL on hover)"
defaults write com.apple.Safari 'ShowStatusBar' -bool true;ok
running "Privacy: don’t send search queries to Apple"
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true;ok
running "Press Tab to highlight each item on a web page"
defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true;ok
running "Show the full URL in the address bar (note: this still hides the scheme)"
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true;ok
running "Set Safari’s home page to google.com"
defaults write com.apple.Safari HomePage -string "https://www.google.com";ok
running "Prevent Safari from opening ‘safe’ files automatically after downloading"
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false;ok
running "Show Safari’s bookmarks bar by default"
defaults write com.apple.Safari ShowFavoritesBar -bool true
defaults write com.apple.Safari ShowFavoritesBar-v2 -bool true;ok
running "Enable Safari’s debug menu"
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true;ok
running "Make Safari’s search banners default to Contains instead of Starts With"
defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false;ok
running "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;ok
running "Add a context menu item for showing the Web Inspector in web views"
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true;ok
running "Enable Do Not Track"
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true;ok
running "Update extensions automatically"
defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true;ok
running "Warn about fraudulent websites"
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true;ok
running "Open new tabs with an empty page"
defaults write com.apple.Safari NewTabBehavior -int 1;ok
running "don't show favorites on the smart search bar"
defaults write com.apple.Safari ShowFavoritesUnderSmartSearchField -bool false;ok
running "don't allow websites to ask for permission to send push notifications"
defaults write com.apple.Safari CanPromptForPushNotifications -bool false;ok
running "include search engine suggestions"
defaults write com.apple.Safari SuppressSearchSuggestions -bool false;ok
# TODO install extensions: "Save to Pocket", "AdBlock", "SessionRestore"
###############################################################################
bot "Configuring Messages Options..."
###############################################################################
running "Disable automatic emoji substitution (i.e. use plain text smileys)"
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false;ok
running "Disable smart quotes as it’s annoying for messages that contain code"
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false;ok
running "Disable continuous spell checking"
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false;ok
###############################################################################
bot "Configuring Mail Options..."
###############################################################################
running "Disable automatic spell checking"
defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled";ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment