├── npm.sh ├── nvim.sh ├── git.sh ├── asdf.sh ├── osxprep.sh ├── README.md ├── LICENSE ├── brew-apps.sh ├── arrange-dock.sh ├── zsh.sh ├── brew.sh ├── install.sh └── osx.sh /npm.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | npm install -g @mermaid-js/mermaid-cli 4 | npm install -g @anthropic-ai/claude-code 5 | -------------------------------------------------------------------------------- /nvim.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Ask for the administrator password upfront 4 | sudo -v 5 | 6 | # Keep-alive: update existing `sudo` time stamp until `osx.sh` has finished 7 | while true; do 8 | sudo -n true 9 | sleep 60 10 | kill -0 "$$" || exit 11 | done 2>/dev/null & 12 | 13 | # Install neovim as a replacement for vim 14 | brew install neovim 15 | 16 | # Install packer as nvim plugin manager 17 | git clone --depth 1 https://github.com/wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim 18 | -------------------------------------------------------------------------------- /git.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Ask for the administrator password upfront 4 | sudo -v 5 | 6 | # Keep-alive: update existing `sudo` time stamp until `osx.sh` has finished 7 | while true; do 8 | sudo -n true 9 | sleep 60 10 | kill -0 "$$" || exit 11 | done 2>/dev/null & 12 | 13 | # Install git-credential-osxkeychain 14 | if test ! "$(command -v git credential-osxkeychain)"; then 15 | echo "Installing git-credential-osxkeychain..." 16 | curl -O http://github-media-downloads.s3.amazonaws.com/osx/git-credential-osxkeychain 17 | mv git-credential-osxkeychain /usr/local/bin/ 18 | chmod u+x /usr/local/bin/git-credential-osxkeychain 19 | fi 20 | -------------------------------------------------------------------------------- /asdf.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Install ASDF version manager for multiple languages 4 | 5 | # Ask for the administrator password upfront. 6 | sudo -v 7 | 8 | # Keep-alive: update existing `sudo` time stamp until the script has finished. 9 | while true; do 10 | sudo -n true 11 | sleep 60 12 | kill -0 "$$" || exit 13 | done 2>/dev/null & 14 | 15 | # Install ASDF (Extendable Version Manager for multiple language runtime versions) 16 | git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.9.0 17 | 18 | # Install common plugins 19 | asdf plugin-add python 20 | asdf plugin-add nodejs 21 | asdf plugin-add haskell 22 | asdf plugin-add ruby 23 | asdf plugin-add rust 24 | asdf plugin-add R 25 | -------------------------------------------------------------------------------- /osxprep.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Ask for the administrator password upfront 4 | sudo -v 5 | 6 | # Keep-alive: update existing `sudo` time stamp until `osxprep.sh` has finished 7 | while true; do 8 | sudo -n true 9 | sleep 60 10 | kill -0 "$$" || exit 11 | done 2>/dev/null & 12 | 13 | # Step 1: Update the OS and Install Xcode Tools 14 | echo "------------------------------" 15 | echo "Updating OSX. If this requires a restart, run the script again." 16 | # Install all available updates 17 | sudo softwareupdate -ia --verbose 18 | # Install only recommended available updates 19 | #sudo softwareupdate -ir --verbose 20 | 21 | echo "------------------------------" 22 | echo "Installing Xcode Command Line Tools." 23 | # Install Xcode command line tools 24 | xcode-select --install 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # mac-setup 2 | 3 | MacOS Development Setup Environment - OSX, ZSH, Homebrew, Vim, Neovim, asdf 4 | 5 | ## Motivation 6 | 7 | A modular approach to setting up your Macbook for development. 8 | 9 | This repo builds on the awesome work from [Donne Martin](https://github.com/donnemartin) and [Thoughtbot](https://github.com/thoughtbot/). 10 | 11 | Compatible dotfiles can be found at https://github.com/aaronmak/dotfiles. 12 | 13 | ## Installation 14 | 15 | * ZSH [`zsh`] 16 | * Homebrew (Includes some helpful binaries and defaults) [`brew`] 17 | * Git config [`git`] 18 | * OSX config [`osx`] 19 | * Applications [`brew-apps`] 20 | * Neovim [`nvim`] 21 | * ASDF (version manager for multiple languages) [`asdf`] 22 | * Dockutil (To edit MacOS Dock) [`arrange-dock`] 23 | 24 | Run the following and select the modules you would like to install. 25 | 26 | ```shell 27 | ./install.sh osxprep zsh brew nvim asdf brew-apps git osx arrange-dock 28 | ``` 29 | 30 | Alternatively, use `all` to install all modules. 31 | 32 | ```shell 33 | ./install.sh all 34 | ``` 35 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This repository contains a variety of content; some developed by Aaron Mak, 2 | and some from third-parties. The third-party content is distributed under the 3 | license provided by those parties. 4 | 5 | The content developed by Aaron Mak is distributed under the following license: 6 | 7 | I am providing code and resources in this repository to you under an open source 8 | license. Because this is my personal repository, the license you receive to my 9 | code and resources is from me and not my employer (Facebook). 10 | 11 | Copyright 2019 Aaron Mak 12 | 13 | Licensed under the Apache License, Version 2.0 (the "License"); 14 | you may not use this file except in compliance with the License. 15 | You may obtain a copy of the License at 16 | 17 | http://www.apache.org/licenses/LICENSE-2.0 18 | 19 | Unless required by applicable law or agreed to in writing, software 20 | distributed under the License is distributed on an "AS IS" BASIS, 21 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | See the License for the specific language governing permissions and 23 | limitations under the License. -------------------------------------------------------------------------------- /brew-apps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Core casks 4 | brew install --cask xquartz 5 | 6 | # Development tool casks 7 | brew install --cask ghostty 8 | brew install --cask dash 9 | brew install --cask keycastr 10 | brew install --cask visual-studio-code 11 | 12 | # Misc casks 13 | brew install --cask 1password/tap/1password-cli 14 | brew install --cask alfred 15 | brew install --cask calibre 16 | brew install --cask disk-inventory-x 17 | brew install --cask firefox 18 | brew install --cask gimp 19 | brew install --cask google-chrome 20 | brew install --cask betterdisplay 21 | brew install --cask rectangle 22 | 23 | # Install mac apps 24 | mas install 1147396723 # Whatsapp Desktop 25 | mas install 1449928544 # Wireless@SGx 26 | mas install 1475387142 # Tailscale 27 | mas install 1480933944 # Vimari 28 | mas install 409183694 # Keynote 29 | mas install 409201541 # Pages 30 | mas install 409203825 # Numbers 31 | mas install 747648890 # Telegram 32 | mas install 803453959 # Slack 33 | 34 | # Install Hack Nerd Font 35 | brew tap homebrew/cask-fonts 36 | brew install --cask font-hack-nerd-font 37 | git clone https://github.com/powerline/fonts.git --depth=1 ~/code/personal/fonts 38 | cd ~/code/personal/fonts || exit 39 | ./install.sh 40 | cd .. 41 | 42 | # Remove outdated versions from the cellar. 43 | brew cleanup 44 | -------------------------------------------------------------------------------- /arrange-dock.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Ask for the administrator password upfront 4 | sudo -v 5 | 6 | # Keep-alive: update existing `sudo` time stamp until `osx.sh` has finished 7 | while true; do 8 | sudo -n true 9 | sleep 60 10 | kill -0 "$$" || exit 11 | done 2>/dev/null & 12 | 13 | # Install if we don't have it 14 | if test ! "$(brew -v)"; then 15 | echo "Installing homebrew..." 16 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 17 | fi 18 | 19 | if test ! "$(dockutil --version)"; then 20 | echo "Install latest version from https://github.com/kcrawford/dockutil/releases" 21 | open "https://github.com/kcrawford/dockutil/releases" 22 | fi 23 | 24 | # Wipe all (default) app icons from the Dock 25 | # This is only really useful when setting up a new Mac, or if you don’t use 26 | # the Dock to launch apps. 27 | defaults write com.apple.dock persistent-apps -array 28 | 29 | dockutil --add /Applications/Safari.app --no-restart --position 2 30 | dockutil --add /Applications/Calendar.app --no-restart --position 3 31 | dockutil --add /Applications/Telegram.app --no-restart --position 4 32 | dockutil --add /Applications/WhatsApp.app --no-restart --position 5 33 | dockutil --add /Applications/Dash.app --no-restart --position 6 34 | dockutil --add /Applications/calibre.app --no-restart --position 7 35 | dockutil --add /Applications/Slack.app --no-restart --position 8 36 | dockutil --add /Applications/Mail.app --no-restart --position 9 37 | dockutil --add '/Applications/Visual Studio Code.app' --no-restart --position 10 38 | 39 | dockutil --add "${HOME}/code" --no-restart --position 1 40 | 41 | killall Dock 42 | -------------------------------------------------------------------------------- /zsh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # shellcheck disable=SC2154 4 | trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT 5 | 6 | set -e 7 | 8 | fancy_echo() { 9 | local fmt="$1"; shift 10 | 11 | # shellcheck disable=SC2059 12 | printf "\\n$fmt\\n" "$@" 13 | } 14 | 15 | append_to_zshrc() { 16 | local text="$1" zshrc 17 | local skip_new_line="${2:-0}" 18 | 19 | if [ -w "$HOME/.zshrc.local" ]; then 20 | zshrc="$HOME/.zshrc.local" 21 | else 22 | zshrc="$HOME/.zshrc" 23 | fi 24 | 25 | if ! grep -Fqs "$text" "$zshrc"; then 26 | if [ "$skip_new_line" -eq 1 ]; then 27 | printf "%s\\n" "$text" >> "$zshrc" 28 | else 29 | printf "\\n%s\\n" "$text" >> "$zshrc" 30 | fi 31 | fi 32 | } 33 | 34 | if [ ! -d "$HOME/.bin/" ]; then 35 | mkdir "$HOME/.bin" 36 | fi 37 | 38 | if [ ! -f "$HOME/.zshrc" ]; then 39 | touch "$HOME/.zshrc" 40 | fi 41 | 42 | # shellcheck disable=SC2016 43 | append_to_zshrc 'export PATH="$HOME/.bin:$PATH"' 44 | 45 | HOMEBREW_PREFIX="/usr/local" 46 | 47 | if [ -d "$HOMEBREW_PREFIX" ]; then 48 | if ! [ -r "$HOMEBREW_PREFIX" ]; then 49 | sudo chown -R "$LOGNAME:admin" /usr/local 50 | fi 51 | else 52 | sudo mkdir "$HOMEBREW_PREFIX" 53 | sudo chflags norestricted "$HOMEBREW_PREFIX" 54 | sudo chown -R "$LOGNAME:admin" "$HOMEBREW_PREFIX" 55 | fi 56 | 57 | update_shell() { 58 | local shell_path; 59 | shell_path="$(command -v zsh)" 60 | 61 | fancy_echo "Changing your shell to zsh ..." 62 | if ! grep "$shell_path" /etc/shells > /dev/null 2>&1 ; then 63 | fancy_echo "Adding '$shell_path' to /etc/shells" 64 | sudo sh -c "echo $shell_path >> /etc/shells" 65 | fi 66 | sudo chsh -s "$shell_path" "$USER" 67 | } 68 | 69 | case "$SHELL" in 70 | */zsh) 71 | if [ "$(command -v zsh)" != '/usr/local/bin/zsh' ] ; then 72 | update_shell 73 | fi 74 | ;; 75 | *) 76 | update_shell 77 | ;; 78 | esac 79 | 80 | if ! command -v brew >/dev/null; then 81 | fancy_echo "Installing Homebrew ..." 82 | curl -fsS \ 83 | 'https://raw.githubusercontent.com/Homebrew/install/master/install' | ruby 84 | 85 | append_to_zshrc '# recommended by brew doctor' 86 | 87 | # shellcheck disable=SC2016 88 | append_to_zshrc 'export PATH="/usr/local/bin:$PATH"' 1 89 | 90 | export PATH="/usr/local/bin:$PATH" 91 | fi 92 | -------------------------------------------------------------------------------- /brew.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # Install command-line tools using Homebrew. 4 | 5 | # Ask for the administrator password upfront. 6 | sudo -v 7 | 8 | # Keep-alive: update existing `sudo` time stamp until the script has finished. 9 | while true; do 10 | sudo -n true 11 | sleep 60 12 | kill -0 "$$" || exit 13 | done 2>/dev/null & 14 | 15 | # Check for Homebrew, 16 | # Install if we don't have it 17 | if test ! "$(brew -v)"; then 18 | echo "Installing homebrew..." 19 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 20 | fi 21 | 22 | # Make sure we’re using the latest Homebrew. 23 | brew update 24 | 25 | # Upgrade any already-installed formulae. 26 | brew upgrade 27 | 28 | # Install GNU core utilities (those that come with OS X are outdated). 29 | # Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`. 30 | brew install coreutils 31 | sudo ln -s /usr/local/bin/gsha256sum /usr/local/bin/sha256sum 32 | 33 | # Install some other useful utilities like `sponge`. 34 | brew install moreutils 35 | # Install GNU `find`, `locate`, `updatedb`, and `xargs`, `g`-prefixed. 36 | brew install findutils 37 | # Install GNU `sed`, overwriting the built-in `sed`. 38 | brew install gnu-sed 39 | brew install gpg 40 | brew install wget 41 | 42 | # Install tmux and plugin manager 43 | brew install tmux 44 | brew install tmate 45 | brew install tmuxinator 46 | git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm 47 | 48 | # Install kube-tmux status line 49 | git clone https://github.com/jonmosco/kube-tmux.git ~/.tmux/kube-tmux 50 | ln -s ~/.tmux/kube-tmux/kube.tmux ~/.tmux/kube.tmux 51 | 52 | # Install more recent versions of some OS X tools. 53 | brew install vim --override-system-vi 54 | brew install grep 55 | brew install openssh 56 | brew install screen 57 | 58 | # Github CLI 59 | brew install gh 60 | 61 | # Kubernetes 62 | brew install kubectx 63 | 64 | # Hashicorp 65 | brew install vault 66 | 67 | # Lxml and Libxslt 68 | brew install libxml2 69 | brew install libxslt 70 | brew link libxml2 --force 71 | brew link libxslt --force 72 | 73 | # Lua 74 | brew install luarocks 75 | 76 | # Useful Stuff 77 | brew install atuin # synced history 78 | brew install bat # cat alternative 79 | brew install cmake 80 | brew install duckdb # fast local OLAP database, good for debugging 81 | brew install entr # runs a command when input changes 82 | brew install eza # ls replacement 83 | brew install fd # find replacement 84 | brew install fzf 85 | brew install git # installs git 86 | brew install jq # parsing json 87 | brew install lua # installs lua 88 | brew install mas # CLI for MacOS App Store 89 | brew install mosh # ssh alternative (mobile shell) 90 | brew install node-build # for nodejs 91 | brew install pandoc # document conversion 92 | brew install peco # interactive text filter 93 | brew install pipx # use python apps in isolated envs 94 | brew install postgresql 95 | brew install qmk/qmk/qmk # keyboard config 96 | brew install reattach-to-user-namespace # for tmux / vim to work properly with clipboard 97 | brew install ripgrep # faster grep 98 | brew install saml2aws # login to AWS 99 | brew install shellcheck 100 | brew install imagemagick # image maniplulation 101 | brew install ghostscript # postscript / pdf interpreter 102 | brew install speedtest-cli 103 | brew install ssh-copy-id 104 | brew install starship # fast terminal prompt 105 | brew install tealdeer # help/man alternative 106 | brew install tig # git alternative 107 | brew install watch # runs a command on a schedule 108 | brew install zoxide # faster path navigation 109 | brew install zsh-autosuggestions 110 | pipx ensurepath 111 | 112 | # fzf keybindings 113 | "$(brew --prefix)"/opt/fzf/install --key-bindings --completion --xdg --no-bash --no-zsh 114 | 115 | # Install poetry 116 | curl -sSL https://install.python-poetry.org | python3 - 117 | 118 | # Install uv 119 | curl -LsSf https://astral.sh/uv/install.sh | sh 120 | 121 | # Remove outdated versions from the cellar. 122 | brew cleanup 123 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | function install() { 4 | # Ask for the administrator password upfront 5 | sudo -v 6 | 7 | # Keep-alive: update existing `sudo` time stamp until the script has finished 8 | while true; do 9 | sudo -n true 10 | sleep 60 11 | kill -0 "$$" || exit 12 | done 2>/dev/null & 13 | 14 | # Run sections based on command line arguments 15 | for ARG in "$@"; do 16 | if [ "$ARG" == "osxprep" ] || [ "$ARG" == "all" ]; then 17 | # Run the osxprep.sh Script 18 | echo "" 19 | echo "------------------------------" 20 | echo "Updating OSX and installing Xcode command line tools" 21 | echo "------------------------------" 22 | echo "" 23 | ./osxprep.sh 24 | fi 25 | if [ "$ARG" == "zsh" ] || [ "$ARG" == "all" ]; then 26 | # Run the zsh.sh Script 27 | echo "" 28 | echo "------------------------------" 29 | echo "Installing zsh to replace bash" 30 | echo "------------------------------" 31 | echo "" 32 | ./zsh.sh 33 | fi 34 | if [ "$ARG" == "oh-my-zsh" ] || [ "$ARG" == "all" ]; then 35 | # Run the zsh.sh Script 36 | echo "" 37 | echo "------------------------------" 38 | echo "Installing oh-my-zsh framework" 39 | echo "------------------------------" 40 | echo "" 41 | ./oh-my-zsh.sh 42 | fi 43 | if [ "$ARG" == "brew" ] || [ "$ARG" == "all" ]; then 44 | # Run the brew.sh Script 45 | # For a full listing of installed formulae and apps, refer to 46 | # the commented brew.sh source file directly and tweak it to 47 | # suit your needs. 48 | echo "" 49 | echo "------------------------------" 50 | echo "Installing Homebrew along with some common formulae." 51 | echo "This might take a while to complete, as some formulae need to be installed from source." 52 | echo "------------------------------" 53 | echo "" 54 | ./brew.sh 55 | fi 56 | if [ "$ARG" == "asdf" ] || [ "$ARG" == "all" ]; then 57 | # Run the asdf.sh Script 58 | echo "" 59 | echo "------------------------------" 60 | echo "Installing asdf." 61 | echo "------------------------------" 62 | echo "" 63 | ./asdf.sh 64 | fi 65 | if [ "$ARG" == "nvim" ] || [ "$ARG" == "all" ]; then 66 | # Run the nvim.sh Script 67 | echo "" 68 | echo "------------------------------" 69 | echo "Installing neovim." 70 | echo "------------------------------" 71 | echo "" 72 | ./nvim.sh 73 | fi 74 | if [ "$ARG" == "brew-apps" ] || [ "$ARG" == "all" ]; then 75 | # Run the brew.sh Script 76 | # For a full listing of installed formulae and apps, refer to 77 | # the commented brew.sh source file directly and tweak it to 78 | # suit your needs. 79 | echo "" 80 | echo "------------------------------" 81 | echo "Installing Homebrew cask apps." 82 | echo "This might take a while to complete, as some formulae need to be installed from source." 83 | echo "------------------------------" 84 | echo "" 85 | ./brew-apps.sh 86 | fi 87 | if [ "$ARG" == "git" ] || [ "$ARG" == "all" ]; then 88 | # Run the git.sh Script 89 | echo "" 90 | echo "------------------------------" 91 | echo "Configuring git." 92 | echo "------------------------------" 93 | echo "" 94 | ./git.sh 95 | fi 96 | if [ "$ARG" == "osx" ] || [ "$ARG" == "all" ]; then 97 | # Run the osx.sh Script 98 | # I strongly suggest you read through the commented osx.sh 99 | # source file and tweak any settings based on your personal 100 | # preferences. The script defaults are intended for you to 101 | # customize. For example, if you are not running an SSD you 102 | # might want to change some of the settings listed in the 103 | # SSD section. 104 | echo "" 105 | echo "------------------------------" 106 | echo "Setting sensible OSX defaults." 107 | echo "------------------------------" 108 | echo "" 109 | ./osx.sh 110 | fi 111 | if [ "$ARG" == "arrange-dock" ] || [ "$ARG" == "all" ]; then 112 | # Run the arrange-dock.sh Script 113 | # Assumes that the applications are already installed 114 | echo "" 115 | echo "------------------------------" 116 | echo "Adding default dock icons." 117 | echo "------------------------------" 118 | echo "" 119 | ./arrange-dock.sh 120 | fi 121 | 122 | if [ "$ARG" == "npm" ] || [ "$ARG" == "all" ]; then 123 | # Run the arrange-dock.sh Script 124 | # Assumes that the applications are already installed 125 | echo "" 126 | echo "------------------------------" 127 | echo "Installing npm stools" 128 | echo "------------------------------" 129 | echo "" 130 | ./npm.sh 131 | fi 132 | 133 | done 134 | 135 | echo "------------------------------" 136 | echo "Completed running .dots, restart your computer to ensure all updates take effect" 137 | echo "------------------------------" 138 | } 139 | 140 | mkdir -p ~/code/work 141 | mkdir -p ~/code/personal 142 | 143 | read -rp "This script may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 144 | echo "" 145 | if [[ $REPLY =~ ^[Yy]$ ]]; then 146 | install "$@" 147 | fi 148 | 149 | unset install 150 | -------------------------------------------------------------------------------- /osx.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | # ~/osx.sh — Originally from https://mths.be/osx 4 | 5 | # Ask for the administrator password upfront 6 | sudo -v 7 | 8 | # Keep-alive: update existing `sudo` time stamp until `osx.sh` has finished 9 | while true; do 10 | sudo -n true 11 | sleep 60 12 | kill -0 "$$" || exit 13 | done 2>/dev/null & 14 | 15 | ############################################################################### 16 | # General UI/UX # 17 | ############################################################################### 18 | 19 | # Set computer name (as done via System Preferences → Sharing) 20 | sudo scutil --set ComputerName "aaronmak" 21 | sudo scutil --set HostName "aaronmak" 22 | sudo scutil --set LocalHostName "aaronmak" 23 | sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "aaronmak" 24 | 25 | # Set standby delay to 24 hours (default is 1 hour or 3600) 26 | #sudo pmset -a standbydelay 86400 27 | 28 | # Disable the sound effects on boot 29 | sudo nvram SystemAudioVolume=" " 30 | 31 | # Menu bar: hide the Time Machine, Volume, and User icons 32 | for domain in ~/Library/Preferences/ByHost/com.apple.systemuiserver.*; do 33 | defaults write "${domain}" dontAutoLoad -array \ 34 | "/System/Library/CoreServices/Menu Extras/TimeMachine.menu" \ 35 | "/System/Library/CoreServices/Menu Extras/Volume.menu" \ 36 | "/System/Library/CoreServices/Menu Extras/User.menu" 37 | done 38 | defaults write com.apple.systemuiserver menuExtras -array \ 39 | "/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \ 40 | "/System/Library/CoreServices/Menu Extras/AirPort.menu" \ 41 | "/System/Library/CoreServices/Menu Extras/Battery.menu" \ 42 | "/System/Library/CoreServices/Menu Extras/Clock.menu" 43 | 44 | # Set sidebar icon size to medium 45 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 46 | 47 | # Always show scrollbars 48 | defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 49 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 50 | 51 | # Disable smooth scrolling 52 | # (Uncomment if you’re on an older Mac that messes up the animation) 53 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 54 | 55 | # Increase window resize speed for Cocoa applications 56 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 57 | 58 | # Expand save panel by default 59 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 60 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 61 | 62 | # Expand print panel by default 63 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 64 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 65 | 66 | # Save to disk (not to iCloud) by default 67 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 68 | 69 | # Automatically quit printer app once the print jobs complete 70 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 71 | 72 | # Disable the “Are you sure you want to open this application?” dialog 73 | #defaults write com.apple.LaunchServices LSQuarantine -bool false 74 | 75 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 76 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 77 | 78 | # Display ASCII control characters using caret notation in standard text views 79 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 80 | defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 81 | 82 | # Disable Resume system-wide 83 | #defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 84 | 85 | # Disable automatic termination of inactive apps 86 | #defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 87 | 88 | # Disable the crash reporter 89 | defaults write com.apple.CrashReporter DialogType -string "none" 90 | 91 | # Set Help Viewer windows to non-floating mode 92 | defaults write com.apple.helpviewer DevMode -bool true 93 | 94 | # Fix for the ancient UTF-8 bug in QuickLook (https://mths.be/bbo) 95 | # Commented out, as this is known to cause problems in various Adobe apps :( 96 | # See https://github.com/mathiasbynens/dotfiles/issues/237 97 | #echo "0x08000100:0" > ~/.CFUserTextEncoding 98 | 99 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 100 | # in the login window 101 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 102 | 103 | # Restart automatically if the computer freezes 104 | sudo systemsetup -setrestartfreeze on 105 | 106 | # Never go into computer sleep mode 107 | # sudo systemsetup -setcomputersleep Off > /dev/null 108 | 109 | # Set the computer to sleep after 60 minutes 110 | #sudo systemsetup -setcomputersleep 60 111 | 112 | # Check for software updates daily, not just once per week 113 | # defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 114 | 115 | # Disable Notification Center and remove the menu bar icon 116 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2>/dev/null 117 | 118 | # Disable smart quotes as they’re annoying when typing code 119 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 120 | 121 | # Disable smart dashes as they’re annoying when typing code 122 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 123 | 124 | # Set a custom wallpaper image. `DefaultDesktop.jpg` is already a symlink, and 125 | # all wallpapers are in `/Library/Desktop Pictures/`. The default is `Wave.jpg`. 126 | #rm -rf ~/Library/Application Support/Dock/desktoppicture.db 127 | #sudo rm -rf /System/Library/CoreServices/DefaultDesktop.jpg 128 | #sudo ln -s /path/to/your/image /System/Library/CoreServices/DefaultDesktop.jpg 129 | 130 | ############################################################################### 131 | # SSD-specific tweaks # 132 | # You might want to disable these if you are not running an SSD # 133 | ############################################################################### 134 | 135 | # Disable hibernation (speeds up entering sleep mode) 136 | sudo pmset -a hibernatemode 0 137 | 138 | # Disable the sudden motion sensor as it’s not useful for SSDs 139 | sudo pmset -a sms 0 140 | 141 | ############################################################################### 142 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 143 | ############################################################################### 144 | 145 | # Trackpad: enable tap to click for this user and for the login screen 146 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 147 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 148 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 149 | 150 | # Trackpad: map bottom right corner to right-click 151 | #defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 152 | #defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 153 | #defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 154 | #defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 155 | 156 | # Use “natural” (Lion-style) scrolling 157 | defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true 158 | 159 | # Increase sound quality for Bluetooth headphones/headsets 160 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 161 | 162 | # Enable full keyboard access for all controls 163 | # (e.g. enable Tab in modal dialogs) 164 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 165 | 166 | # Disable press-and-hold for keys in favor of key repeat 167 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 168 | 169 | # Set a blazingly fast keyboard repeat rate 170 | defaults write NSGlobalDomain KeyRepeat -int 1 171 | defaults write NSGlobalDomain InitialKeyRepeat -int 15 172 | 173 | # Set language and text formats 174 | defaults write NSGlobalDomain AppleLanguages -array "en" 175 | defaults write NSGlobalDomain AppleLocale -string "en_SG@currency=SGD" 176 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 177 | defaults write NSGlobalDomain AppleMetricUnits -bool true 178 | 179 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 180 | sudo systemsetup -settimezone "Asia/Singapore" >/dev/null 181 | 182 | # Disable auto-correct 183 | #defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 184 | 185 | # Stop iTunes from responding to the keyboard media keys 186 | #launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null 187 | 188 | ############################################################################### 189 | # Screen # 190 | ############################################################################### 191 | 192 | # Require password immediately after sleep or screen saver begins 193 | defaults write com.apple.screensaver askForPassword -int 1 194 | defaults write com.apple.screensaver askForPasswordDelay -int 0 195 | 196 | # Save screenshots to the desktop 197 | defaults write com.apple.screencapture location -string "${HOME}/Desktop" 198 | 199 | # Save screenshots to the Pictures/Screenshots 200 | #mkdir ${HOME}/Pictures/Screenshots 201 | #defaults write com.apple.screencapture location -string "${HOME}/Pictures/Screenshots" 202 | 203 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 204 | defaults write com.apple.screencapture type -string "png" 205 | 206 | # Disable shadow in screenshots 207 | defaults write com.apple.screencapture disable-shadow -bool true 208 | 209 | # Enable subpixel font rendering on non-Apple LCDs 210 | defaults write NSGlobalDomain AppleFontSmoothing -int 2 211 | 212 | # Enable HiDPI display modes (requires restart) 213 | sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 214 | 215 | ############################################################################### 216 | # Finder # 217 | ############################################################################### 218 | 219 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 220 | defaults write com.apple.finder QuitMenuItem -bool true 221 | 222 | # Finder: disable window animations and Get Info animations 223 | defaults write com.apple.finder DisableAllAnimations -bool true 224 | 225 | # Set Desktop as the default location for new Finder windows 226 | # For other paths, use `PfLo` and `file:///full/path/here/` 227 | defaults write com.apple.finder NewWindowTarget -string "PfDe" 228 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" 229 | 230 | # Show icons for hard drives, servers, and removable media on the desktop 231 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 232 | defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 233 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 234 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 235 | 236 | # Finder: show hidden files by default 237 | defaults write com.apple.finder AppleShowAllFiles -bool true 238 | 239 | # Finder: show all filename extensions 240 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 241 | 242 | # Finder: show status bar 243 | defaults write com.apple.finder ShowStatusBar -bool true 244 | 245 | # Finder: show path bar 246 | defaults write com.apple.finder ShowPathbar -bool true 247 | 248 | # Finder: allow text selection in Quick Look 249 | defaults write com.apple.finder QLEnableTextSelection -bool true 250 | 251 | # Display full POSIX path as Finder window title 252 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 253 | 254 | # When performing a search, search the current folder by default 255 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 256 | 257 | # Disable the warning when changing a file extension 258 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 259 | 260 | # Enable spring loading for directories 261 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 262 | 263 | # Tweak the spring loading delay for directories 264 | defaults write NSGlobalDomain com.apple.springing.delay -float .5 265 | 266 | # Avoid creating .DS_Store files on network volumes 267 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 268 | 269 | # Disable disk image verification 270 | #defaults write com.apple.frameworks.diskimages skip-verify -bool true 271 | #defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 272 | #defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 273 | 274 | # Automatically open a new Finder window when a volume is mounted 275 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 276 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 277 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 278 | 279 | # Show item info near icons on the desktop and in other icon views 280 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 281 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 282 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 283 | 284 | # Show item info at the bottom of the icons on the desktop 285 | /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom true" ~/Library/Preferences/com.apple.finder.plist 286 | 287 | # Enable snap-to-grid for icons on the desktop and in other icon views 288 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 289 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 290 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 291 | 292 | # Set grid spacing for icons on the desktop and in other icon views 293 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist 294 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist 295 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 50" ~/Library/Preferences/com.apple.finder.plist 296 | 297 | # Set the size of icons on the desktop and in other icon views 298 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 24" ~/Library/Preferences/com.apple.finder.plist 299 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 24" ~/Library/Preferences/com.apple.finder.plist 300 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 24" ~/Library/Preferences/com.apple.finder.plist 301 | 302 | # Use list view in all Finder windows by default 303 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` 304 | defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" 305 | 306 | # Disable the warning before emptying the Trash 307 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 308 | 309 | # Empty Trash securely by default 310 | defaults write com.apple.finder EmptyTrashSecurely -bool true 311 | 312 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 313 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 314 | 315 | # Show the ~/Library folder 316 | chflags nohidden ~/Library 317 | 318 | # Expand the following File Info panes: 319 | # “General”, “Open with”, and “Sharing & Permissions” 320 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 321 | General -bool true \ 322 | OpenWith -bool true \ 323 | Privileges -bool true 324 | 325 | ############################################################################### 326 | # Dock, Dashboard, and hot corners # 327 | ############################################################################### 328 | 329 | # Enable highlight hover effect for the grid view of a stack (Dock) 330 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 331 | 332 | # Set the icon size of Dock items to 36 pixels 333 | defaults write com.apple.dock tilesize -int 36 334 | 335 | # Change minimize/maximize window effect 336 | defaults write com.apple.dock mineffect -string "scale" 337 | 338 | # Minimize windows into their application’s icon 339 | #defaults write com.apple.dock minimize-to-application -bool true 340 | 341 | # Enable spring loading for all Dock items 342 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 343 | 344 | # Show indicator lights for open applications in the Dock 345 | defaults write com.apple.dock show-process-indicators -bool true 346 | 347 | # Wipe all (default) app icons from the Dock 348 | # This is only really useful when setting up a new Mac, or if you don’t use 349 | # the Dock to launch apps. 350 | defaults write com.apple.dock persistent-apps -array 351 | 352 | # Don’t animate opening applications from the Dock 353 | defaults write com.apple.dock launchanim -bool false 354 | 355 | # Speed up Mission Control animations 356 | defaults write com.apple.dock expose-animation-duration -float 0.1 357 | 358 | # Don’t group windows by application in Mission Control 359 | # (i.e. use the old Exposé behavior instead) 360 | defaults write com.apple.dock expose-group-by-app -bool false 361 | 362 | # Don’t automatically rearrange Spaces based on most recent use 363 | defaults write com.apple.dock mru-spaces -bool false 364 | 365 | # Remove the auto-hiding Dock delay 366 | defaults write com.apple.dock autohide-delay -float 0 367 | # Remove the animation when hiding/showing the Dock 368 | defaults write com.apple.dock autohide-time-modifier -float 0 369 | 370 | # Automatically hide and show the Dock 371 | defaults write com.apple.dock autohide -bool true 372 | 373 | # Reset Launchpad, but keep the desktop wallpaper intact 374 | find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete 375 | 376 | ############################################################################### 377 | # Safari & WebKit # 378 | ############################################################################### 379 | 380 | # Privacy: don’t send search queries to Apple 381 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 382 | 383 | # Press Tab to highlight each item on a web page 384 | defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 385 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 386 | 387 | # Show the full URL in the address bar (note: this still hides the scheme) 388 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 389 | 390 | # Set Safari’s home page to `about:blank` for faster loading 391 | defaults write com.apple.Safari HomePage -string "about:blank" 392 | 393 | # Prevent Safari from opening ‘safe’ files automatically after downloading 394 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 395 | 396 | # Allow hitting the Backspace key to go to the previous page in history 397 | #defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 398 | 399 | # Hide Safari’s bookmarks bar by default 400 | defaults write com.apple.Safari ShowFavoritesBar -bool false 401 | 402 | # Hide Safari’s sidebar in Top Sites 403 | defaults write com.apple.Safari ShowSidebarInTopSites -bool false 404 | 405 | # Disable Safari’s thumbnail cache for History and Top Sites 406 | defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 407 | 408 | # Enable Safari’s debug menu 409 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 410 | 411 | # Make Safari’s search banners default to Contains instead of Starts With 412 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 413 | 414 | # Remove useless icons from Safari’s bookmarks bar 415 | defaults write com.apple.Safari ProxiesInBookmarksBar "()" 416 | 417 | # Enable the Develop menu and the Web Inspector in Safari 418 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 419 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 420 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 421 | 422 | # Add a context menu item for showing the Web Inspector in web views 423 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 424 | 425 | ############################################################################### 426 | # Mail # 427 | ############################################################################### 428 | 429 | # Disable send and reply animations in Mail.app 430 | defaults write com.apple.mail DisableReplyAnimations -bool true 431 | defaults write com.apple.mail DisableSendAnimations -bool true 432 | 433 | # Copy email addresses as `foo@example.com` instead of `Foo Bar ` in Mail.app 434 | defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false 435 | 436 | # Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app 437 | defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9" 438 | 439 | # Display emails in threaded mode, sorted by date (oldest at the top) 440 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "DisplayInThreadedMode" -string "yes" 441 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortedDescending" -string "yes" 442 | defaults write com.apple.mail DraftsViewerAttributes -dict-add "SortOrder" -string "received-date" 443 | 444 | # Disable inline attachments (just show the icons) 445 | defaults write com.apple.mail DisableInlineAttachmentViewing -bool true 446 | 447 | # Disable automatic spell checking 448 | # defaults write com.apple.mail SpellCheckingBehavior -string "NoSpellCheckingEnabled" 449 | 450 | ############################################################################### 451 | # Spotlight # 452 | ############################################################################### 453 | 454 | # Change indexing order and disable some search results 455 | # Yosemite-specific search results (remove them if your are using OS X 10.9 or older): 456 | # MENU_DEFINITION 457 | # MENU_CONVERSION 458 | # MENU_EXPRESSION 459 | # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) 460 | # MENU_WEBSEARCH (send search queries to Apple) 461 | # MENU_OTHER 462 | defaults write com.apple.spotlight orderedItems -array \ 463 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 464 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 465 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 466 | '{"enabled" = 1;"name" = "PDF";}' \ 467 | '{"enabled" = 1;"name" = "FONTS";}' \ 468 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 469 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 470 | '{"enabled" = 0;"name" = "CONTACT";}' \ 471 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 472 | '{"enabled" = 0;"name" = "IMAGES";}' \ 473 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 474 | '{"enabled" = 0;"name" = "MUSIC";}' \ 475 | '{"enabled" = 0;"name" = "MOVIES";}' \ 476 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 477 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 478 | '{"enabled" = 0;"name" = "SOURCE";}' \ 479 | '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \ 480 | '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 481 | '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ 482 | '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 483 | '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 484 | '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 485 | # Load new settings before rebuilding the index 486 | killall mds >/dev/null 2>&1 487 | # Make sure indexing is enabled for the main volume 488 | sudo mdutil -i on / >/dev/null 489 | # Rebuild the index from scratch 490 | sudo mdutil -E / >/dev/null 491 | 492 | ############################################################################### 493 | # Terminal 494 | ############################################################################### 495 | 496 | # Only use UTF-8 in Terminal.app 497 | defaults write com.apple.terminal StringEncodings -array 4 498 | 499 | # Enable “focus follows mouse” for Terminal.app and all X11 apps 500 | # i.e. hover over a window and start typing in it without clicking first 501 | #defaults write com.apple.terminal FocusFollowsMouse -bool true 502 | #defaults write org.x.X11 wm_ffm -bool true 503 | 504 | start_if_needed() { 505 | local grep_name="[${1:0:1}]${1:1}" 506 | 507 | if [[ -z $(pgrep "${grep_name}") ]]; then 508 | if [ -e "$HOME/Applications/$1.app" ]; then 509 | open "$HOME/Applications/$1.app" 510 | else 511 | if [ -e "/Applications/$1.app" ]; then 512 | open "/Applications/$1.app" 513 | fi 514 | fi 515 | fi 516 | 517 | true 518 | } 519 | 520 | ############################################################################### 521 | # Time Machine # 522 | ############################################################################### 523 | 524 | # Prevent Time Machine from prompting to use new hard drives as backup volume 525 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 526 | 527 | ############################################################################### 528 | # Activity Monitor # 529 | ############################################################################### 530 | 531 | # Show the main window when launching Activity Monitor 532 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 533 | 534 | # Visualize CPU usage in the Activity Monitor Dock icon 535 | defaults write com.apple.ActivityMonitor IconType -int 5 536 | 537 | # Show all processes in Activity Monitor 538 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 539 | 540 | # Sort Activity Monitor results by CPU usage 541 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 542 | defaults write com.apple.ActivityMonitor SortDirection -int 0 543 | 544 | ############################################################################### 545 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 546 | ############################################################################### 547 | 548 | # Enable the debug menu in Address Book 549 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 550 | 551 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 552 | defaults write com.apple.dashboard devmode -bool true 553 | 554 | # Enable the debug menu in iCal (pre-10.8) 555 | defaults write com.apple.iCal IncludeDebugMenu -bool true 556 | 557 | # Use plain text mode for new TextEdit documents 558 | defaults write com.apple.TextEdit RichText -int 0 559 | # Open and save files as UTF-8 in TextEdit 560 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 561 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 562 | # Set tab width to 4 instead of the default 8 563 | defaults write com.apple.TextEdit "TabWidth" '4' 564 | 565 | # Enable the debug menu in Disk Utility 566 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 567 | defaults write com.apple.DiskUtility advanced-image-options -bool true 568 | 569 | ############################################################################### 570 | # Mac App Store # 571 | ############################################################################### 572 | 573 | # Enable the WebKit Developer Tools in the Mac App Store 574 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 575 | 576 | # Enable Debug Menu in the Mac App Store 577 | defaults write com.apple.appstore ShowDebugMenu -bool true 578 | 579 | ############################################################################### 580 | # Messages # 581 | ############################################################################### 582 | 583 | # Disable automatic emoji substitution (i.e. use plain text smileys) 584 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticEmojiSubstitutionEnablediMessage" -bool false 585 | 586 | # Disable smart quotes as it’s annoying for messages that contain code 587 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 588 | 589 | # Disable continuous spell checking 590 | #defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false 591 | 592 | ############################################################################### 593 | # Google Chrome & Google Chrome Canary # 594 | ############################################################################### 595 | 596 | # Allow installing user scripts via GitHub Gist or Userscripts.org 597 | defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 598 | defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 599 | 600 | # Disable the all too sensitive backswipe on trackpads 601 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 602 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 603 | 604 | # Disable the all too sensitive backswipe on Magic Mouse 605 | defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false 606 | defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false 607 | 608 | # Use the system-native print preview dialog 609 | defaults write com.google.Chrome DisablePrintPreview -bool true 610 | defaults write com.google.Chrome.canary DisablePrintPreview -bool true 611 | 612 | # Expand the print dialog by default 613 | defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 614 | defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 615 | 616 | ############################################################################### 617 | # GPGMail 2 # 618 | ############################################################################### 619 | 620 | # Disable signing emails by default 621 | defaults write ~/Library/Preferences/org.gpgtools.gpgmail SignNewEmailsByDefault -bool false 622 | 623 | ############################################################################### 624 | # Kill affected applications # 625 | ############################################################################### 626 | 627 | for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ 628 | "Dock" "Finder" "Google Chrome" "Google Chrome Canary" "Mail" "Messages" \ 629 | "Safari" "SystemUIServer" \ 630 | "iCal"; do 631 | killall "${app}" >/dev/null 2>&1 632 | done 633 | echo "Done. Note that some of these changes require a logout/restart of your OS to take effect. At a minimum, be sure to restart your Terminal." 634 | --------------------------------------------------------------------------------