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