├── .editorconfig ├── .gitignore ├── LICENSE ├── README.md ├── install └── lib ├── ask.sh ├── defaults.sh ├── dotfiles.sh └── install.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | # This file is for unifying the coding style for different editors and IDEs 2 | # editorconfig.org 3 | 4 | root = true 5 | 6 | 7 | [*] 8 | end_of_line = lf 9 | charset = utf-8 10 | trim_trailing_whitespace = true 11 | insert_final_newline = true 12 | 13 | # Use tabs in Bash 14 | [**.{sh,bash}] 15 | indent_style = tab 16 | indent_size = 4 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | Thumbs.db 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Jannis R 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # osx-setup – Jumpstart OS X. 2 | 3 | - [shrinks the default OS X installation](lib/shrink.sh) 4 | - installs [developer stuff](lib/install.sh) like [Homebrew](http://brew.sh/), [node.js](https://nodejs.org/) and [the Fish Shell](http://fishshell.com/) 5 | - sets [opinionated developer-friends defaults](lib/defaults.sh) 6 | - installs [my dotfiles](https://github.com/derhuerst/dotfiles) 7 | 8 | 9 | 10 | ## Install 11 | 12 | You need [OS X](http://www.apple.com/osx/) to install this. [Bash](http://de.wikipedia.org/wiki/Bash_%28Shell%29) is required, but already bundled with OS X. 13 | 14 | ```shell 15 | curl -sSL https://raw.githubusercontent.com/derhuerst/osx-setup/master/install | bash 16 | ``` 17 | 18 | 19 | 20 | ## Contributing 21 | 22 | If you **have a question**, **found a bug** or want to **propose a feature**, have a look at [the issues page](https://github.com/derhuerst/osx-setup/issues). 23 | -------------------------------------------------------------------------------- /install: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | 5 | eval "$(curl -sSL https://raw.githubusercontent.com/derhuerst/osx-setup/master/lib/ask.sh)" 6 | eval "$(curl -sSL https://raw.githubusercontent.com/derhuerst/osx-setup/master/lib/install.sh)" 7 | eval "$(curl -sSL https://raw.githubusercontent.com/derhuerst/osx-setup/master/lib/defaults.sh)" 8 | eval "$(curl -sSL https://raw.githubusercontent.com/derhuerst/osx-setup/master/lib/dotfiles.sh)" 9 | 10 | printf "Your system is set up, you should restart now. Have fun! 🍺\n" -------------------------------------------------------------------------------- /lib/ask.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This is a general-purpose function to ask Yes/No questions in Bash. It keeps repeating the question until it gets a valid answer. 3 | # https://gist.github.com/davejamesmiller/1965569 4 | 5 | 6 | 7 | ask() { 8 | while true; do 9 | read -n 1 -p "$1 [y/n] > " REPLY 10 | case "$REPLY" in 11 | Y*|y*) 12 | printf "\n" 13 | return 0 14 | ;; 15 | N*|n*) 16 | printf "\n" 17 | return 1 18 | ;; 19 | esac 20 | done 21 | } -------------------------------------------------------------------------------- /lib/defaults.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script sets a lot of `defaults`. It 3 | # - deactivates all sorts of animations 4 | # - shows hidden files 5 | # - optimizes the Finder 6 | # - improves on the Dock 7 | 8 | 9 | 10 | printf "Some customizations require root priveledges. Please enter your password.\n" 11 | sudo -v 12 | printf "Thanks.\n\n" 13 | 14 | 15 | 16 | if ask 'Disable startup sound?'; then 17 | sudo nvram SystemAudioVolume=" " 18 | fi 19 | 20 | if ask 'Increase window resize speed for Cocoa applications?'; then 21 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 22 | fi 23 | 24 | if ask 'Do not restore windows after ⌘ + Q?'; then 25 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 26 | fi 27 | 28 | if ask 'Disable menu bar transparency?'; then 29 | defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false 30 | fi 31 | 32 | if ask 'Expand save panel by default?'; then 33 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 34 | fi 35 | 36 | if ask 'Expand print panel by default?'; then 37 | defaults write NSGlobalDomain NSNavPanelExpandedStateForPrint -bool true 38 | fi 39 | 40 | if ask 'Disable the warning when changing file extensions?'; then 41 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 42 | fi 43 | 44 | 45 | 46 | # System 47 | 48 | if ask 'Show all processes in Activity Monitor?'; then 49 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 50 | fi 51 | 52 | if ask 'Stop asking to use new hard drives as Time Machine volume?'; then 53 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 54 | fi 55 | 56 | if ask 'Show ~/Library in Finder?'; then 57 | chflags nohidden ~/Library 58 | fi 59 | 60 | if ask 'Show /bin, /sbin and /usr in Finder?'; then 61 | sudo chflags nohidden /bin 62 | sudo chflags nohidden /sbin 63 | sudo chflags nohidden /usr 64 | fi 65 | 66 | if ask 'Only use UTF-8 in Terminal.app?'; then 67 | defaults write com.apple.terminal StringEncodings -array 4 68 | fi 69 | 70 | if ask 'Disable guest account?'; then 71 | sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool NO 72 | fi 73 | 74 | 75 | 76 | # Spotlight 77 | 78 | if ask 'Hide useless things in Spotlight?'; then 79 | defaults write com.apple.spotlight orderedItems -array \ 80 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 81 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 82 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 83 | '{"enabled" = 1;"name" = "PDF";}' \ 84 | '{"enabled" = 1;"name" = "DOCUMENTS";}' \ 85 | '{"enabled" = 1;"name" = "MESSAGES";}' \ 86 | '{"enabled" = 1;"name" = "CONTACT";}' \ 87 | '{"enabled" = 1;"name" = "EVENT_TODO";}' \ 88 | '{"enabled" = 1;"name" = "IMAGES";}' \ 89 | '{"enabled" = 1;"name" = "MUSIC";}' \ 90 | '{"enabled" = 1;"name" = "MOVIES";}' \ 91 | '{"enabled" = 1;"name" = "PRESENTATIONS";}' \ 92 | '{"enabled" = 1;"name" = "SPREADSHEETS";}' \ 93 | '{"enabled" = 1;"name" = "SOURCE";}' \ 94 | '{"enabled" = 1;"name" = "MENU_DEFINITION";}' \ 95 | '{"enabled" = 1;"name" = "MENU_CONVERSION";}' \ 96 | '{"enabled" = 0;"name" = "FONTS";}' \ 97 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 98 | '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 99 | '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 100 | '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 101 | '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 102 | fi 103 | 104 | 105 | 106 | # Dock 107 | 108 | if ask 'Enable spring loading for all Dock items?'; then 109 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 110 | fi 111 | 112 | if ask 'Show indicator lights for open applications in the Dock?'; then 113 | defaults write com.apple.dock show-process-indicators -bool true 114 | fi 115 | 116 | if ask 'Set the icon size of Dock items to 40 pixels?'; then 117 | defaults write com.apple.dock tilesize -int 40 118 | fi 119 | 120 | if ask 'Automatically hide and show the Dock?'; then 121 | defaults write com.apple.dock autohide -bool true 122 | if ask 'Show & hide Dock instantly?'; then 123 | defaults write com.apple.dock autohide-time-modifier -float 0 124 | fi 125 | if ask 'Autohide Dock without delay?'; then 126 | defaults write com.apple.dock autohide-delay -float 0 127 | fi 128 | fi 129 | 130 | if ask 'Change minimize/maximize window effect to scaling?'; then 131 | defaults write com.apple.dock mineffect -string 'scale' 132 | fi 133 | 134 | if ask 'Clear Dock & put useful apps inside?'; then 135 | writeDockItems() { 136 | defaults write com.apple.dock persistent-apps -array 137 | curl -OsS https://raw.githubusercontent.com/kcrawford/dockutil/7e7b56dae7a118c256748c2f69c82b912d64c6e2/scripts/dockutil 138 | chmod +x ./dockutil 139 | 140 | apps=$1 141 | for app in "${apps[@]}"; do 142 | echo $app 143 | if [ "$app" = "spacer" ]; then 144 | defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type="spacer-tile";}' 145 | continue 146 | fi 147 | app="/Applications/$app" 148 | if [ -e "$app" ]; then 149 | ./dockutil --add "$app" --position end 150 | fi 151 | done 152 | 153 | rm ./dockutil 154 | } 155 | 156 | apps=('' \ 157 | 'System Preferences.app' \ 158 | 'spacer' \ 159 | 'Mail.app' \ 160 | 'Notes.app' \ 161 | 'Telegram.app' \ 162 | 'Telephone.app' \ 163 | 'Slack.app' \ 164 | 'Skype.app' \ 165 | 'spacer' \ 166 | 'Firefox.app' \ 167 | 'Safari.app' \ 168 | 'Google Chrome.app' \ 169 | 'spacer' \ 170 | 'Sublime Text.app' \ 171 | 'Utilities/Terminal.app' \ 172 | 'Marked 2.app' \ 173 | 'iA Writer.app' \ 174 | 'Transmit.app' \ 175 | 'spacer' 176 | ) 177 | writeDockItems $apps 178 | fi 179 | 180 | 181 | 182 | # Mission Control 183 | 184 | if ask 'Show & hide Mission Control instantly.'; then 185 | defaults write com.apple.dock expose-animation-duration -float 0.1 186 | fi 187 | 188 | if ask 'Stop rearranging Spaces based on recent use?'; then 189 | defaults write com.apple.dock mru-spaces -bool false 190 | fi 191 | 192 | 193 | 194 | # Keyboard & Mouse 195 | 196 | if ask 'Set a very fast keyboard repeat rate?'; then 197 | defaults write NSGlobalDomain KeyRepeat -int 1 198 | fi 199 | 200 | if ask 'Set a short Delay until key repeat?'; then 201 | defaults write NSGlobalDomain InitialKeyRepeat -int 12 202 | fi 203 | 204 | if ask 'Enable full keyboard access for all controls?'; then 205 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 206 | fi 207 | 208 | if ask 'Automatically illuminate keyboard in low light?'; then 209 | defaults write com.apple.BezelServices kDim -bool true 210 | fi 211 | 212 | if ask 'Turn off keyboard illumination when inactive for 2 minutes?'; then 213 | defaults write com.apple.BezelServices kDimTime -int 120 214 | fi 215 | 216 | if ask 'Trackpad: Enable tap to click?'; then 217 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 218 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 219 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 220 | fi 221 | 222 | if ask 'Trackpad: Two-finger tap for right click?'; then 223 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 224 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 225 | fi 226 | 227 | if ask 'Enable dragging with three fingers?'; then 228 | defaults write com.apple.AppleMultitouchTrackpad TrackpadThreeFingerDrag -bool true 229 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true 230 | fi 231 | 232 | 233 | 234 | # Safari 235 | 236 | if ask 'Safari: Show the full URL in the address bar?'; then 237 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 238 | fi 239 | 240 | if ask 'Safari: Stop sending search queries to Apple?'; then 241 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 242 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 243 | fi 244 | 245 | if ask 'Set Safari’s home page to `about:blank`?'; then 246 | defaults write com.apple.Safari HomePage -string 'about:blank' 247 | fi 248 | 249 | if ask 'Enable Safari’s debug menu?'; then 250 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 251 | fi 252 | 253 | if ask 'Wipe Safari’s bookmarks bar?'; then 254 | defaults write com.apple.Safari ProxiesInBookmarksBar '()' 255 | fi 256 | 257 | 258 | 259 | # Finder 260 | 261 | if ask 'Open a new window when a volume is mounted?'; then 262 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 263 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 264 | fi 265 | 266 | if ask 'Display full path as window title?'; then 267 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 268 | fi 269 | 270 | if ask 'Show the status bar?'; then 271 | defaults write com.apple.finder ShowStatusBar -bool true 272 | fi 273 | 274 | if ask 'Open new windows with ~/Downloads?'; then 275 | defaults write com.apple.finder NewWindowTarget -string 'PfLo' 276 | defaults write com.apple.finder NewWindowTargetPath -string 'file://${HOME}/Downloads/' 277 | fi 278 | 279 | if ask 'Use current directory as default search scope?'; then 280 | defaults write com.apple.finder FXDefaultSearchScope -string 'SCcf' 281 | fi 282 | 283 | if ask 'Allow text selection in Quick Look?'; then 284 | defaults write com.apple.finder QLEnableTextSelection -bool true 285 | fi 286 | 287 | if ask 'Enable spring loading for directories?'; then 288 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 289 | fi 290 | 291 | if ask 'Remove the spring loading delay for directories?'; then 292 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 293 | fi 294 | 295 | if ask 'Show hidden files?'; then 296 | defaults write com.apple.finder AppleShowAllFiles -bool true 297 | fi 298 | 299 | if ask 'Show all filename extensions?'; then 300 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 301 | fi 302 | 303 | if ask 'Make column view the default?'; then 304 | defaults write com.apple.finder FXPreferredViewStyle -string 'clmv' 305 | fi 306 | 307 | 308 | 309 | # Miscellaneous 310 | 311 | if ask 'Disable the warning before emptying the Trash?'; then 312 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 313 | fi 314 | 315 | if ask 'Automatically quit printer app once the print jobs complete?'; then 316 | defaults write com.apple.print.PrintingPrefs 'Quit When Finished' -bool true 317 | fi 318 | 319 | if ask 'Avoid creating .DS_Store files on network volumes.'; then 320 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 321 | fi 322 | 323 | if ask 'Change screenshot location?'; then 324 | defaults write com.apple.screencapture location ~/Downloads/ 325 | fi 326 | 327 | if ask 'Save screenshots in PNG format?'; then 328 | defaults write com.apple.screencapture type -string 'png' 329 | fi 330 | 331 | if ask 'Save to disk (not to iCloud) by default?'; then 332 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 333 | fi 334 | 335 | if ask 'Disable send and reply animations in Mail.app?'; then 336 | defaults write com.apple.mail DisableReplyAnimations -bool true 337 | defaults write com.apple.mail DisableSendAnimations -bool true 338 | fi 339 | 340 | if ask 'Enable snap-to-grid for desktop icons?'; then 341 | /usr/libexec/PlistBuddy -c 'Set :DesktopViewSettings:IconViewSettings:arrangeBy grid' ~/Library/Preferences/com.apple.finder.plist 342 | fi 343 | 344 | if ask 'Use plain text by default in TextEdit.app?'; then 345 | defaults write com.apple.TextEdit RichText -int 0 346 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 347 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 348 | fi 349 | 350 | if ask 'Disable menu bar transparency?'; then 351 | defaults write NSGlobalDomain AppleEnableMenuBarTransparency -bool false 352 | fi 353 | 354 | 355 | 356 | printf "Save all your work now! Continue by hitting return." 357 | read -p '' 358 | 359 | for app in 'Activity Monitor' 'Address Book' 'Calendar' 'Contacts' 'cfprefsd' \ 360 | 'Dock' 'Finder' 'Mail' 'Messages' 'Safari' 'SizeUp' 'SystemUIServer' \ 361 | 'Terminal' 'Transmission' 'Twitter' 'iCal'; do 362 | killall $app > /dev/null 2>&1 363 | done 364 | 365 | printf "Done, you should restart now. Have fun! 🍺\n" 366 | -------------------------------------------------------------------------------- /lib/dotfiles.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This installs derhuerst/dotfiles 3 | 4 | 5 | 6 | if ask 'Install derhuerst/dotfiles?'; then 7 | curl -sSL https://raw.githubusercontent.com/derhuerst/dotfiles/master/install | bash 8 | fi 9 | -------------------------------------------------------------------------------- /lib/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # This script installs developer stuff on OS X. 3 | 4 | 5 | 6 | xcode-select --install 7 | 8 | # install homebrew 9 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" 10 | 11 | brew tap dandavison/delta https://github.com/dandavison/delta 12 | brew install \ 13 | asciinema \ 14 | bash \ 15 | bat \ 16 | coreutils \ 17 | curl \ 18 | dog \ 19 | dwdiff \ 20 | ffmpeg \ 21 | findutils \ 22 | fish \ 23 | fzf \ 24 | gh \ 25 | git \ 26 | git-delta \ 27 | gnu-tar \ 28 | gnu-time \ 29 | gnupg \ 30 | grep \ 31 | htop \ 32 | iperf3 \ 33 | jq \ 34 | miller \ 35 | mitmproxy \ 36 | moreutils \ 37 | mosh \ 38 | node \ 39 | postgis \ 40 | pstree \ 41 | pv \ 42 | qrencode \ 43 | redis \ 44 | rename \ 45 | restic \ 46 | ripgrep \ 47 | speedtest-cli \ 48 | ssh-copy-id \ 49 | starship \ 50 | terminal-notifier \ 51 | tldr \ 52 | tree \ 53 | wget \ 54 | xsv \ 55 | yt-dlp 56 | 57 | if [ $(cat /private/etc/shells | grep $(command -v fish) | wc -l) -eq 0 ]; then 58 | sudo bash -c "echo $(command -v fish) >> /private/etc/shells" 59 | fi 60 | 61 | npm install -g \ 62 | serve \ 63 | localtunnel \ 64 | spoof \ 65 | time-tracking \ 66 | url-decode-encode-cli \ 67 | parse-url-cli \ 68 | query-string-cli \ 69 | util-inspect-cli \ 70 | pev2-cli \ 71 | dependency-check 72 | 73 | 74 | 75 | brew install caskroom/cask/brew-cask 76 | brew cask install \ 77 | firefox \ 78 | transmission \ 79 | github \ 80 | cocoapacketanalyzer \ 81 | keka \ 82 | vlc \ 83 | imageoptim \ 84 | sublime-text \ 85 | telegram 86 | 87 | 88 | 89 | brew cask install \ 90 | quicklook-csv \ 91 | quicklook-json \ 92 | qlmarkdown \ 93 | qlstephen \ 94 | qlcolorcode 95 | 96 | qlmanage -r 97 | qlmanage -r cache 98 | 99 | 100 | 101 | brew cleanup 102 | --------------------------------------------------------------------------------