├── .oh-my-zsh-custom ├── aliases.zsh └── functions.zsh ├── Package Control.sublime-settings ├── Preferences.sublime-settings ├── README.md ├── defaults.sh └── install.sh /.oh-my-zsh-custom/aliases.zsh: -------------------------------------------------------------------------------- 1 | # git 2 | alias gl='git log --oneline --decorate' 3 | # compdef _git gl=git-log 4 | 5 | alias gll='gl --abbrev-commit --all --graph --color' 6 | # compdef _gt gll=git-log 7 | 8 | alias glr='git pull --rebase' 9 | # compdef _git glr=git-pull 10 | 11 | alias gs='git status -sb' 12 | # compdef _git gs=git-status 13 | 14 | alias gd='git diff' 15 | # compdef _git gd=git-diff 16 | 17 | # rails 2 18 | alias sc='script/console' 19 | alias ss='script/server' 20 | alias sg='script/generate' 21 | alias sd='script/destroy' 22 | 23 | # rails 3 24 | alias sr='script/rails' 25 | 26 | # rails custom 27 | alias sn='script/news --oneline' 28 | 29 | # ps 30 | alias pgrep='ps ax | grep -v grep | grep $1' 31 | 32 | # sublime 33 | alias sp='subl "${PWD##*/}.sublime-project"' 34 | 35 | # imageoptim 36 | alias optim_changed='git status --porcelain | awk "{print $2}" | imageOptim' 37 | 38 | # show git conflicts 39 | alias git_conflicts='git diff --name-only --diff-filter=U' 40 | -------------------------------------------------------------------------------- /.oh-my-zsh-custom/functions.zsh: -------------------------------------------------------------------------------- 1 | function tlog() { 2 | if test "$1" = ""; then 3 | tail -f log/development.log 4 | else 5 | tail -f "log/$1.log" 6 | fi 7 | } 8 | 9 | function track_git_branch() { 10 | if test "`current_branch`" = ""; then 11 | echo 'Not in git repo.'; 12 | else 13 | echo "running: git branch --set-upstream `current_branch` origin/`current_branch`"; 14 | git branch --set-upstream `current_branch` origin/`current_branch`; 15 | fi 16 | } 17 | 18 | function _findproc { 19 | ps ax | grep -v grep | grep -q "$1" 20 | } 21 | 22 | function whatsup { 23 | _findproc resque-web && echo resque-web 24 | _findproc mailcatcher && echo mailcatcher 25 | _findproc unicorn && echo unicorn 26 | _findproc mysql && echo mysql 27 | _findproc postgres && echo postgres 28 | _findproc riak && echo riak 29 | _findproc redis && echo redis 30 | _findproc resque && echo resque 31 | _findproc irb && echo irb 32 | _findproc rasterizer && echo rasterizer 33 | _findproc elasticsearch && echo elasticsearch 34 | _findproc "rails server" && echo '"rails server"' 35 | _findproc spring && echo spring 36 | } 37 | 38 | function ytmp3 { 39 | youtube-dl -i "$1" -o "%(title)s.%(ext)s" --extract-audio --audio-format "mp3" 40 | } 41 | -------------------------------------------------------------------------------- /Package Control.sublime-settings: -------------------------------------------------------------------------------- 1 | { 2 | "installed_packages": 3 | [ 4 | "All Autocomplete", 5 | "Babel", 6 | "GitGutter", 7 | "Sass", 8 | "SideBarEnhancements", 9 | "SublimeLinter", 10 | "SublimeLinter-jshint", 11 | "Markdown Extended", 12 | "Pretty JSON", 13 | "SyncedSideBar", 14 | "A File Icon" 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /Preferences.sublime-settings: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "animation_enabled": false, 4 | "bold_folder_labels": false, 5 | "default_encoding": "UTF-8", 6 | "enable_tab_scrolling": false, 7 | "enable_telemetry": false, 8 | "ensure_newline_at_eof_on_save": true, 9 | "file_exclude_patterns": 10 | [ 11 | "*.sassc", 12 | "*.scssc", 13 | "*.log", 14 | "*.gem", 15 | "*.gz", 16 | "*.pdf", 17 | "*.zip", 18 | "*.DS_store", 19 | "*.eot", 20 | "*.svg", 21 | "*.ttf", 22 | "*.woff", 23 | "*.tags*", 24 | "nohup.out", 25 | "*.cache", 26 | ".keep", 27 | "*.gemtags" 28 | ], 29 | "folder_exclude_patterns": 30 | [ 31 | ".git", 32 | "node_modules" 33 | ], 34 | "font_face": "Monaco", 35 | "font_size": 13, 36 | "gutter": true, 37 | "highlight_line": true, 38 | "highlight_modified_tabs": true, 39 | "hot_exit": false, 40 | "indent_guide_options": 41 | [ 42 | "draw_normal" 43 | ], 44 | "remember_open_files": false, 45 | "rulers": 46 | [ 47 | 80 48 | ], 49 | "show_full_path": true, 50 | "show_minimap": false, 51 | "sublimelinter_gutter_marks": false, 52 | "tabs_medium": true, 53 | "tabs_padding_medium": true, 54 | "tab_size": 2, 55 | "translate_tabs_to_spaces": true, 56 | "trim_trailing_white_space_on_save": true, 57 | "use_simple_full_screen": true, 58 | "word_separators": "./\\()\"'-:,.;<>~!@#$%^&*|+=[]{}`~" 59 | } 60 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Setting up new laptop 2 | 3 | 1. Install XCode command line tools ([https://developer.apple.com/downloads/](https://developer.apple.com/downloads/), "Sign In" required) 4 | 1. Run `sudo chown -R $USER /usr/local` 5 | 1. Run install.sh (see below) 6 | 1. Run installers that need to be finished separately (uTorrent, Hearthstone, etc.) 7 | 1. Run OS X customization file (aka Mathias .osx, see below) 8 | 1. Update OS X and apps (through App Store) 9 | 1. Map Caps to Ctrl in keyboard settings (since this is apparently quite difficult to do programmatically http://apple.stackexchange.com/questions/13598/updating-modifier-key-mappings-through-defaults-command-tool) 10 | 1. Add translit as an input source in System Prefs (+ map it to Alt+Cmd+Space) 11 | 1. Set Quicksilver triggers 12 | 1. Customize iTerm settings ("quit when all windows are closed", "preserve window positions", etc.; should this be automated?) 13 | 1. Install messenger from https://fbmacmessenger.rsms.me/ (as of 2017-01-12 doesn't seem to work on High Sierra) 14 | 1. Install Twitter on App Store 15 | 1. Install Rocket from http://matthewpalmer.net/rocket/ 16 | 17 | 18 | ## install.sh 19 | 20 | This is the main script that installs 90%+ of things required to get a "working" OS X. It's meant to be run as part of a fresh install on a new laptop. 21 | 22 | In a nutshell, it does this: 23 | 24 | - Installs all the brews that I use (git, zsh, cairo, node, postgresql, etc.) 25 | - Installs all the applications that I use, via cask (chrome, quicksilver, imageoptim, virtualbox, etc.) 26 | - Installs oh-my-zsh and sets it up 27 | - Generates SSH keys (and opens github settings page for convenience) 28 | - Installs global node packages that I use often (bower, jshint, jscs, etc.) 29 | - Customizes Sublime using other files from this repo 30 | - Installs translit keyboard 31 | 32 | ## defaults.sh 33 | 34 | Sets up sensible OS X defaults and other useful tweaks. Based on Mathias' excellent .osx 35 | 36 | ## Package Control.sublime-settings 37 | 38 | Specifies which Sublime packages to install 39 | 40 | ## Preferences.sublime-settings 41 | 42 | Specifies main Sublime settings 43 | 44 | ## .oh-my-zsh-custom 45 | 46 | Defines custom functions and alises for oh-my-zsh 47 | 48 | ## Inspired by / shamelessly stolen from these fine folks 49 | 50 | - [Hacker's Guide to Setting Up Your Mac](http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac) 51 | - [Thoughtbot's laptop setup](https://github.com/thoughtbot/laptop/blob/master/mac) 52 | - [Hakunin's dotfiles](https://github.com/maxim/dotfiles) 53 | - [Mathias' .osx](https://github.com/mathiasbynens/dotfiles/blob/master/.osx) 54 | 55 | ## Something similar (found later) 56 | 57 | - [Miller Medeiros' Setup Mac OS X Mountain Lion or Mavericks](https://gist.github.com/millermedeiros/6615994) 58 | -------------------------------------------------------------------------------- /defaults.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################### 4 | # My custom version of Mathias' excellent https://mths.be/osx # 5 | ############################################################################### 6 | 7 | # Ask for the administrator password upfront 8 | sudo -v 9 | 10 | # Keep-alive: update existing `sudo` time stamp until `.osx` has finished 11 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 12 | 13 | ############################################################################### 14 | # General UI/UX # 15 | ############################################################################### 16 | 17 | sudo scutil --set ComputerName "kangax" 18 | sudo scutil --set HostName "kangax" 19 | sudo scutil --set LocalHostName "kangax" 20 | 21 | # Set standby delay to 24 hours (default is 1 hour) 22 | sudo pmset -a standbydelay 86400 23 | 24 | # Disable the sound effects on boot 25 | sudo nvram SystemAudioVolume=" " 26 | 27 | # Set sidebar icon size to medium 28 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 29 | 30 | # Always show scrollbars 31 | defaults write NSGlobalDomain AppleShowScrollBars -string "Always" 32 | # Possible values: `WhenScrolling`, `Automatic` and `Always` 33 | 34 | # Disable smooth scrolling 35 | # (Uncomment if you’re on an older Mac that messes up the animation) 36 | #defaults write NSGlobalDomain NSScrollAnimationEnabled -bool false 37 | 38 | # Increase window resize speed for Cocoa applications 39 | defaults write NSGlobalDomain NSWindowResizeTime -float 0.001 40 | 41 | # Expand save panel by default 42 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true 43 | defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true 44 | 45 | # Expand print panel by default 46 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true 47 | defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true 48 | 49 | # Save to disk (not to iCloud) by default 50 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 51 | 52 | # Automatically quit printer app once the print jobs complete 53 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 54 | 55 | # Disable the “Are you sure you want to open this application?” dialog 56 | defaults write com.apple.LaunchServices LSQuarantine -bool false 57 | 58 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 59 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 60 | 61 | # Display ASCII control characters using caret notation in standard text views 62 | # Try e.g. `cd /tmp; unidecode "\x{0000}" > cc.txt; open -e cc.txt` 63 | defaults write NSGlobalDomain NSTextShowsControlCharacters -bool true 64 | 65 | # Disable Resume system-wide 66 | defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false 67 | 68 | # Disable automatic termination of inactive apps 69 | defaults write NSGlobalDomain NSDisableAutomaticTermination -bool true 70 | 71 | # Disable the crash reporter 72 | #defaults write com.apple.CrashReporter DialogType -string "none" 73 | 74 | # Set Help Viewer windows to non-floating mode 75 | defaults write com.apple.helpviewer DevMode -bool true 76 | 77 | # Reveal IP address, hostname, OS version, etc. when clicking the clock 78 | # in the login window 79 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 80 | 81 | # Restart automatically if the computer freezes 82 | sudo systemsetup -setrestartfreeze on 83 | 84 | # Never go into computer sleep mode 85 | sudo systemsetup -setcomputersleep Off > /dev/null 86 | 87 | # Check for software updates daily, not just once per week 88 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 89 | 90 | # Disable Notification Center and remove the menu bar icon 91 | launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null 92 | 93 | # Disable smart quotes as they’re annoying when typing code 94 | defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false 95 | 96 | # Disable smart dashes as they’re annoying when typing code 97 | defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false 98 | 99 | ############################################################################### 100 | # SSD-specific tweaks # 101 | ############################################################################### 102 | 103 | # Disable local Time Machine snapshots 104 | sudo tmutil disablelocal 105 | 106 | # Disable hibernation (speeds up entering sleep mode) 107 | sudo pmset -a hibernatemode 0 108 | 109 | # Remove the sleep image file to save disk space 110 | sudo rm /private/var/vm/sleepimage 111 | # Create a zero-byte file instead… 112 | sudo touch /private/var/vm/sleepimage 113 | # …and make sure it can’t be rewritten 114 | sudo chflags uchg /private/var/vm/sleepimage 115 | 116 | # Disable the sudden motion sensor as it’s not useful for SSDs 117 | sudo pmset -a sms 0 118 | 119 | ############################################################################### 120 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 121 | ############################################################################### 122 | 123 | # Trackpad: enable tap to click for this user and for the login screen 124 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 125 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 126 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 127 | 128 | # Trackpad: map bottom right corner to right-click 129 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 130 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 131 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 132 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 133 | 134 | # Disable “natural” (Lion-style) scrolling 135 | defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 136 | 137 | # Increase sound quality for Bluetooth headphones/headsets 138 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 139 | 140 | # Enable full keyboard access for all controls 141 | # (e.g. enable Tab in modal dialogs) 142 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 143 | 144 | # Use scroll gesture with the Ctrl (^) modifier key to zoom 145 | defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true 146 | defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144 147 | # Follow the keyboard focus while zoomed in 148 | defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true 149 | 150 | # Disable press-and-hold for keys in favor of key repeat 151 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 152 | 153 | # Set a blazingly fast keyboard repeat rate 154 | defaults write NSGlobalDomain KeyRepeat -int 0 155 | 156 | # Set language and text formats 157 | # Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with 158 | # `Inches`, `en_GB` with `en_US`, and `true` with `false`. 159 | defaults write NSGlobalDomain AppleLanguages -array "en" "ru" 160 | defaults write NSGlobalDomain AppleLocale -string "en_US@currency=USD" 161 | defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters" 162 | defaults write NSGlobalDomain AppleMetricUnits -bool true 163 | 164 | # Set the timezone; see `sudo systemsetup -listtimezones` for other values 165 | sudo systemsetup -settimezone "Europe/Brussels" > /dev/null 166 | 167 | # Disable auto-correct 168 | defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false 169 | 170 | ############################################################################### 171 | # Screen # 172 | ############################################################################### 173 | 174 | # Require password immediately after sleep or screen saver begins 175 | defaults write com.apple.screensaver askForPassword -int 1 176 | defaults write com.apple.screensaver askForPasswordDelay -int 0 177 | 178 | # Save screenshots to the desktop 179 | defaults write com.apple.screencapture location -string "${HOME}/Desktop" 180 | 181 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 182 | defaults write com.apple.screencapture type -string "png" 183 | 184 | # Disable shadow in screenshots 185 | defaults write com.apple.screencapture disable-shadow -bool true 186 | 187 | # Enable subpixel font rendering on non-Apple LCDs 188 | defaults write NSGlobalDomain AppleFontSmoothing -int 2 189 | 190 | # Enable HiDPI display modes (requires restart) 191 | sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true 192 | 193 | ############################################################################### 194 | # Finder # 195 | ############################################################################### 196 | 197 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 198 | defaults write com.apple.finder QuitMenuItem -bool true 199 | 200 | # Finder: disable window animations and Get Info animations 201 | defaults write com.apple.finder DisableAllAnimations -bool true 202 | 203 | # Set Desktop as the default location for new Finder windows 204 | # For other paths, use `PfLo` and `file:///full/path/here/` 205 | defaults write com.apple.finder NewWindowTarget -string "PfDe" 206 | defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/" 207 | 208 | # Show icons for hard drives, servers, and removable media on the desktop 209 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 210 | # defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true 211 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 212 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 213 | 214 | # Finder: show hidden files by default 215 | #defaults write com.apple.finder AppleShowAllFiles -bool true 216 | 217 | # Finder: show all filename extensions 218 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 219 | 220 | # Finder: show status bar 221 | defaults write com.apple.finder ShowStatusBar -bool true 222 | 223 | # Finder: show path bar 224 | defaults write com.apple.finder ShowPathbar -bool true 225 | 226 | # Finder: allow text selection in Quick Look 227 | defaults write com.apple.finder QLEnableTextSelection -bool true 228 | 229 | # Display full POSIX path as Finder window title 230 | defaults write com.apple.finder _FXShowPosixPathInTitle -bool true 231 | 232 | # When performing a search, search the current folder by default 233 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 234 | 235 | # Disable the warning when changing a file extension 236 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 237 | 238 | # Enable spring loading for directories 239 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 240 | 241 | # Remove the spring loading delay for directories 242 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 243 | 244 | # Avoid creating .DS_Store files on network volumes 245 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 246 | 247 | # Disable disk image verification 248 | defaults write com.apple.frameworks.diskimages skip-verify -bool true 249 | defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true 250 | defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true 251 | 252 | # Automatically open a new Finder window when a volume is mounted 253 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 254 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 255 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 256 | 257 | # Show item info near icons on the desktop and in other icon views 258 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 259 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 260 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist 261 | 262 | # Show item info to the right of the icons on the desktop 263 | /usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist 264 | 265 | # Enable snap-to-grid for icons on the desktop and in other icon views 266 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 267 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 268 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist 269 | 270 | # Increase grid spacing for icons on the desktop and in other icon views 271 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 272 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 273 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:gridSpacing 100" ~/Library/Preferences/com.apple.finder.plist 274 | 275 | # Increase the size of icons on the desktop and in other icon views 276 | /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 277 | /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 278 | /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:iconSize 80" ~/Library/Preferences/com.apple.finder.plist 279 | 280 | # Use list view in all Finder windows by default 281 | # Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv` 282 | defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" 283 | 284 | # Disable the warning before emptying the Trash 285 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 286 | 287 | # Empty Trash securely by default 288 | defaults write com.apple.finder EmptyTrashSecurely -bool true 289 | 290 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 291 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 292 | 293 | # Enable the MacBook Air SuperDrive on any Mac 294 | sudo nvram boot-args="mbasd=1" 295 | 296 | # Show the ~/Library folder 297 | chflags nohidden ~/Library 298 | 299 | # Remove Dropbox’s green checkmark icons in Finder 300 | file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 301 | [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 302 | 303 | # Expand the following File Info panes: 304 | # “General”, “Open with”, and “Sharing & Permissions” 305 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 306 | General -bool true \ 307 | OpenWith -bool true \ 308 | Privileges -bool true 309 | 310 | ############################################################################### 311 | # Dock, Dashboard, and hot corners # 312 | ############################################################################### 313 | 314 | # Enable highlight hover effect for the grid view of a stack (Dock) 315 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 316 | 317 | # Set the icon size of Dock items to 36 pixels 318 | defaults write com.apple.dock tilesize -int 36 319 | 320 | # Change minimize/maximize window effect 321 | defaults write com.apple.dock mineffect -string "scale" 322 | 323 | # Minimize windows into their application’s icon 324 | defaults write com.apple.dock minimize-to-application -bool true 325 | 326 | # Enable spring loading for all Dock items 327 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 328 | 329 | # Show indicator lights for open applications in the Dock 330 | defaults write com.apple.dock show-process-indicators -bool true 331 | 332 | # Don’t animate opening applications from the Dock 333 | defaults write com.apple.dock launchanim -bool false 334 | 335 | # Speed up Mission Control animations 336 | defaults write com.apple.dock expose-animation-duration -float 0.1 337 | 338 | # Don’t group windows by application in Mission Control 339 | # (i.e. use the old Exposé behavior instead) 340 | defaults write com.apple.dock expose-group-by-app -bool false 341 | 342 | # Disable Dashboard 343 | defaults write com.apple.dashboard mcx-disabled -bool true 344 | 345 | # Don’t show Dashboard as a Space 346 | defaults write com.apple.dock dashboard-in-overlay -bool true 347 | 348 | # Don’t automatically rearrange Spaces based on most recent use 349 | defaults write com.apple.dock mru-spaces -bool false 350 | 351 | # Make Dock icons of hidden applications translucent 352 | defaults write com.apple.dock showhidden -bool true 353 | 354 | # Disable the Launchpad gesture (pinch with thumb and three fingers) 355 | #defaults write com.apple.dock showLaunchpadGestureEnabled -int 0 356 | 357 | # Reset Launchpad, but keep the desktop wallpaper intact 358 | find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete 359 | 360 | # Add iOS Simulator to Launchpad 361 | sudo ln -sf "/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app" "/Applications/iOS Simulator.app" 362 | 363 | ############################################################################### 364 | # Safari & WebKit # 365 | ############################################################################### 366 | 367 | # Privacy: don’t send search queries to Apple 368 | defaults write com.apple.Safari UniversalSearchEnabled -bool false 369 | defaults write com.apple.Safari SuppressSearchSuggestions -bool true 370 | 371 | # Press Tab to highlight each item on a web page 372 | defaults write com.apple.Safari WebKitTabToLinksPreferenceKey -bool true 373 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2TabsToLinks -bool true 374 | 375 | # Show the full URL in the address bar (note: this still hides the scheme) 376 | defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true 377 | 378 | # Set Safari’s home page to `about:blank` for faster loading 379 | defaults write com.apple.Safari HomePage -string "about:blank" 380 | 381 | # Prevent Safari from opening ‘safe’ files automatically after downloading 382 | defaults write com.apple.Safari AutoOpenSafeDownloads -bool false 383 | 384 | # Allow hitting the Backspace key to go to the previous page in history 385 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true 386 | 387 | # Hide Safari’s bookmarks bar by default 388 | defaults write com.apple.Safari ShowFavoritesBar -bool false 389 | 390 | # Hide Safari’s sidebar in Top Sites 391 | defaults write com.apple.Safari ShowSidebarInTopSites -bool false 392 | 393 | # Disable Safari’s thumbnail cache for History and Top Sites 394 | defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2 395 | 396 | # Enable Safari’s debug menu 397 | defaults write com.apple.Safari IncludeInternalDebugMenu -bool true 398 | 399 | # Make Safari’s search banners default to Contains instead of Starts With 400 | defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false 401 | 402 | # Remove useless icons from Safari’s bookmarks bar 403 | defaults write com.apple.Safari ProxiesInBookmarksBar "()" 404 | 405 | # Enable the Develop menu and the Web Inspector in Safari 406 | defaults write com.apple.Safari IncludeDevelopMenu -bool true 407 | defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true 408 | defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true 409 | 410 | # Add a context menu item for showing the Web Inspector in web views 411 | defaults write NSGlobalDomain WebKitDeveloperExtras -bool true 412 | 413 | ############################################################################### 414 | # Spotlight # 415 | ############################################################################### 416 | 417 | # Hide Spotlight tray-icon (and subsequent helper) 418 | # sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search 419 | # Disable Spotlight indexing for any volume that gets mounted and has not yet 420 | # been indexed before. 421 | # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume. 422 | sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes" 423 | # Change indexing order and disable some search results 424 | # Yosemite-specific search results (remove them if your are using OS X 10.9 or older): 425 | # MENU_DEFINITION 426 | # MENU_CONVERSION 427 | # MENU_EXPRESSION 428 | # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) 429 | # MENU_WEBSEARCH (send search queries to Apple) 430 | # MENU_OTHER 431 | defaults write com.apple.spotlight orderedItems -array \ 432 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 433 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 434 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 435 | '{"enabled" = 1;"name" = "PDF";}' \ 436 | '{"enabled" = 1;"name" = "FONTS";}' \ 437 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 438 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 439 | '{"enabled" = 0;"name" = "CONTACT";}' \ 440 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 441 | '{"enabled" = 0;"name" = "IMAGES";}' \ 442 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 443 | '{"enabled" = 0;"name" = "MUSIC";}' \ 444 | '{"enabled" = 0;"name" = "MOVIES";}' \ 445 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 446 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 447 | '{"enabled" = 0;"name" = "SOURCE";}' \ 448 | '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \ 449 | '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 450 | '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ 451 | '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 452 | '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 453 | '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 454 | # Load new settings before rebuilding the index 455 | killall mds > /dev/null 2>&1 456 | # Make sure indexing is enabled for the main volume 457 | sudo mdutil -i on / > /dev/null 458 | # Rebuild the index from scratch 459 | sudo mdutil -E / > /dev/null 460 | 461 | ############################################################################### 462 | # Terminal & iTerm 2 # 463 | ############################################################################### 464 | 465 | # Only use UTF-8 in Terminal.app 466 | defaults write com.apple.terminal StringEncodings -array 4 467 | 468 | # Don’t display the annoying prompt when quitting iTerm 469 | defaults write com.googlecode.iterm2 PromptOnQuit -bool false 470 | 471 | ############################################################################### 472 | # Time Machine # 473 | ############################################################################### 474 | 475 | # Prevent Time Machine from prompting to use new hard drives as backup volume 476 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 477 | 478 | # Disable local Time Machine backups 479 | hash tmutil &> /dev/null && sudo tmutil disablelocal 480 | 481 | ############################################################################### 482 | # Activity Monitor # 483 | ############################################################################### 484 | 485 | # Show the main window when launching Activity Monitor 486 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 487 | 488 | # Visualize CPU usage in the Activity Monitor Dock icon 489 | defaults write com.apple.ActivityMonitor IconType -int 5 490 | 491 | # Show all processes in Activity Monitor 492 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 493 | 494 | # Sort Activity Monitor results by CPU usage 495 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 496 | defaults write com.apple.ActivityMonitor SortDirection -int 0 497 | 498 | ############################################################################### 499 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 500 | ############################################################################### 501 | 502 | # Enable the debug menu in Address Book 503 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 504 | 505 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 506 | defaults write com.apple.dashboard devmode -bool true 507 | 508 | # Enable the debug menu in iCal (pre-10.8) 509 | defaults write com.apple.iCal IncludeDebugMenu -bool true 510 | 511 | # Use plain text mode for new TextEdit documents 512 | defaults write com.apple.TextEdit RichText -int 0 513 | 514 | # Open and save files as UTF-8 in TextEdit 515 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 516 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 517 | 518 | # Enable the debug menu in Disk Utility 519 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 520 | defaults write com.apple.DiskUtility advanced-image-options -bool true 521 | 522 | ############################################################################### 523 | # Mac App Store # 524 | ############################################################################### 525 | 526 | # Enable the WebKit Developer Tools in the Mac App Store 527 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 528 | 529 | # Enable Debug Menu in the Mac App Store 530 | defaults write com.apple.appstore ShowDebugMenu -bool true 531 | 532 | 533 | ############################################################################### 534 | # Google Chrome & Google Chrome Canary # 535 | ############################################################################### 536 | 537 | # Allow installing user scripts via GitHub Gist or Userscripts.org 538 | defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 539 | defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 540 | 541 | # Disable the all too sensitive backswipe on trackpads 542 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 543 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 544 | 545 | # Disable the all too sensitive backswipe on Magic Mouse 546 | defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false 547 | defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false 548 | 549 | # Use the system-native print preview dialog 550 | defaults write com.google.Chrome DisablePrintPreview -bool true 551 | defaults write com.google.Chrome.canary DisablePrintPreview -bool true 552 | 553 | # Expand the print dialog by default 554 | defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 555 | defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 556 | 557 | 558 | ############################################################################### 559 | # Kill affected applications # 560 | ############################################################################### 561 | 562 | for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ 563 | "Dock" "Finder" "Google Chrome" "Google Chrome Canary" "Mail" "Messages" \ 564 | "Opera" "Safari" "SizeUp" "Spectacle" "SystemUIServer" "Terminal" \ 565 | "Transmission" "Twitter" "iCal"; do 566 | killall "${app}" > /dev/null 2>&1 567 | done 568 | echo "Done. Note that some of these changes require a logout/restart to take effect." 569 | -------------------------------------------------------------------------------- /install.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | ########### 4 | # 5 | # First, download & install XCode Dev Tools — https://developer.apple.com/downloads/ 6 | # 7 | ########### 8 | 9 | # Ask for the administrator password upfront 10 | sudo -v 11 | 12 | # Keep-alive: update existing sudo time stamp if set, otherwise do nothing. 13 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 14 | 15 | # borrowed from https://github.com/thoughtbot/laptop 16 | append_to_zshrc() { 17 | local text="$1" zshrc 18 | local skip_new_line="${2:-0}" 19 | 20 | if [ -w "$HOME/.zshrc.local" ]; then 21 | zshrc="$HOME/.zshrc.local" 22 | else 23 | zshrc="$HOME/.zshrc" 24 | fi 25 | 26 | if ! grep -Fqs "$text" "$zshrc"; then 27 | if [ "$skip_new_line" -eq 1 ]; then 28 | printf "%s\n" "$text" >> "$zshrc" 29 | else 30 | printf "\n%s\n" "$text" >> "$zshrc" 31 | fi 32 | fi 33 | } 34 | 35 | echo "Checking for Homebrew..." 36 | if test ! $(which brew); then 37 | echo "Installing homebrew..." 38 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 39 | fi 40 | 41 | # echo "Setting brew permissions..." 42 | # chown -R $USER /usr/local/include 43 | # chown -R $USER /usr/local/lib/pkgconfig 44 | 45 | # Inspired by http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac 46 | 47 | echo "Updating brew..." 48 | brew update 49 | 50 | echo "Installing GNU core utils (those that come with OS X are outdated)..." 51 | brew install coreutils 52 | 53 | echo "Installing more recent versions of some OS X tools..." 54 | brew tap homebrew/dupes 55 | brew install homebrew/dupes/grep 56 | 57 | # TODO add utils to zsh path 58 | 59 | binaries=( 60 | ack 61 | autojump 62 | cairo 63 | curl 64 | casperjs 65 | ffmpeg 66 | git 67 | git-extras 68 | git-town 69 | grep 70 | imagemagick --with-webp 71 | mackup 72 | node 73 | postgresql 74 | pkg-config 75 | rbenv 76 | redis 77 | rhino 78 | ruby-build 79 | slimerjs 80 | tree 81 | unrar 82 | wget 83 | youtube-dl 84 | zopfli 85 | zsh 86 | ) 87 | 88 | echo "Installing binaries..." 89 | brew install ${binaries[@]} 90 | 91 | echo "Cleaning up..." 92 | brew cleanup 93 | 94 | echo "Installing Cask..." 95 | brew install caskroom/cask/brew-cask 96 | 97 | echo "Adding nightly/beta Cask versions..." 98 | brew tap caskroom/versions 99 | 100 | # Apps 101 | apps=( 102 | 103 | # work 104 | rowanj-gitx 105 | iterm2 106 | virtualbox 107 | 108 | # productivity, core, runtimes 109 | caffeine 110 | quicksilver 111 | nvalt 112 | appcleaner 113 | osxfuse 114 | 1password 115 | spectacle 116 | flash-npapi 117 | java 118 | quicklook-json 119 | macpar-deluxe 120 | notational-velocity 121 | grandperspective 122 | istat-menus 123 | qlvideo # to display video files in finder and quick look 124 | 125 | # sharing 126 | dropbox 127 | 128 | # browsers 129 | google-chrome 130 | 131 | # entertainment 132 | spotify 133 | vlc 134 | 135 | # file sharing 136 | qbittorrent 137 | ) 138 | 139 | echo "Installing apps to /Applications..." 140 | brew cask install --appdir="/Applications" ${apps[@]} 141 | 142 | brew cask cleanup 143 | 144 | echo "Installing oh-my-zsh..." 145 | sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 146 | 147 | echo "Customizing oh-my-zsh..." 148 | mkdir -p ~/.oh-my-zsh-custom 149 | wget https://raw.githubusercontent.com/kangax/osx/master/.oh-my-zsh-custom/aliases.zsh && mv aliases.zsh ~/.oh-my-zsh-custom 150 | wget https://raw.githubusercontent.com/kangax/osx/master/.oh-my-zsh-custom/functions.zsh && mv functions.zsh ~/.oh-my-zsh-custom 151 | 152 | # TODO: Customize `plugins=(git ...)` in .zshrc 153 | # TODO: Add path to .oh-my-zsh-custom in .zshrc 154 | # See https://github.com/maxim/dotfiles/blob/f381e8e6248184e453caa92284a10592b6914ef1/.zshrc#L8-L9 155 | 156 | echo "Making autojump work with zsh..." 157 | append_to_zshrc '[[ -s `brew --prefix`/etc/autojump.sh ]] && . `brew --prefix`/etc/autojump.sh' 158 | 159 | echo "Generating SSH keys (https://help.github.com/articles/generating-ssh-keys)..." 160 | ssh-keygen -t rsa -C "kangax@gmail.com" 161 | eval "$(ssh-agent -s)" 162 | ssh-add ~/.ssh/id_rsa 163 | pbcopy < ~/.ssh/id_rsa.pub 164 | open https://github.com/settings/ssh 165 | 166 | # echo "Customizing OSX..." 167 | # https://github.com/mathiasbynens/dotfiles/blob/master/.osx 168 | 169 | # TODO: triggers for quicksilver 170 | 171 | echo "Installing translit..." 172 | wget http://www.math.tamu.edu/~comech/tools/russian-translit-keyboard-layout-mac-os-x/russian-translit.keylayout && mv russian-translit.keylayout ~/Library/Keyboard\ Layouts/ 173 | 174 | echo "Installing nvm..." 175 | wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.26.1/install.sh | bash 176 | 177 | echo "Installing global node packages..." 178 | node_packages=( 179 | git-open 180 | import-js 181 | prettier 182 | flow 183 | yarn 184 | ) 185 | npm install -g ${node_packages[@]} 186 | 187 | echo "Customizing Sublime..." 188 | 189 | # download and "install" Package Control 190 | wget https://sublime.wbond.net/Package\ Control.sublime-package && mv Package\ Control.sublime-package ~/Library/Application\ Support/Sublime\ Text\ 3/Installed\ Packages 191 | 192 | # download and "install" Preferences file 193 | wget https://rawgit.com/kangax/osx/master/Preferences.sublime-settings && mv Preferences.sublime-settings ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User 194 | 195 | # download and "install" Packages file 196 | wget https://rawgit.com/kangax/osx/master/Package\ Control.sublime-settings && mv Package\ Control.sublime-settings ~/Library/Application\ Support/Sublime\ Text\ 3/Packages/User 197 | --------------------------------------------------------------------------------