├── .zshrc ├── README.md ├── config ├── .gitconfig ├── .gitignore └── .osx ├── installs ├── brew_installs └── gem_installs ├── resources.sh ├── setup.sh └── zsh_files ├── .aliases └── .functions /.zshrc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | ##### INSTALLATION PATH ##### 4 | export ZSH=~/.dotfiles/zsh/.oh-my-zsh 5 | source $ZSH/oh-my-zsh.sh 6 | 7 | ##### MISC VARS ##### 8 | # Look in ~/.oh-my-zsh/themes/ 9 | ZSH_THEME="sorin" 10 | 11 | #load in all dotfiles 12 | for file in ~/Developer/.dotfiles/zsh_files/.{aliases,functions}; do 13 | [ -r "$file" ] && [ -f "$file" ] && source "$file"; 14 | done; 15 | 16 | ##### PLUGINS ##### 17 | plugins=(git) 18 | 19 | ##### USER CONFIG ##### 20 | export PATH="YOUR PATH" 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### Setup 4 | 1. This tool assists in the installation of dotfiles as you set up a new computer or simply seek to make your existing system better! 5 | 2. Once you clone it to your computer, preferably to root (`~`), you just need to run `setup.sh` to get started! 6 | 3. This dotfiles tool contains: 7 | - zsh installation and default setup 8 | - Bundled installation of brew, node, & ruby 9 | - A series of optionally installable npm modules 10 | - A series of optionally installable atom plugins/extensions 11 | - A series of optionally installable brew & brew cask packages 12 | - A series of optionally installable ruby gems 13 | - Simple set of terminal aliases and functions 14 | - Global gitconfig credentials and handy set of git aliases 15 | 16 | 4. Please enjoy and share with those whom you think might benefit! 17 | 18 | Licensed with [WTFPL](http://www.wtfpl.net/) ¯\\_ _(ツ)_ _/¯ 19 | -------------------------------------------------------------------------------- /config/.gitconfig: -------------------------------------------------------------------------------- 1 | [user] 2 | name = YOUR NAME 3 | email = YOUR EMAIL 4 | 5 | [core] 6 | editor = nano 7 | whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol, space-before-tab 8 | excludesfile = ~/.gitignore 9 | 10 | [web] 11 | browser = google-chrome 12 | 13 | [rerere] 14 | enabled = 1 15 | autoupdate = 1 16 | 17 | [push] 18 | default = simple 19 | 20 | [color] 21 | ui = auto 22 | 23 | [help] 24 | autocorrect = 1 25 | 26 | [color "branch"] 27 | current = yellow bold 28 | local = green bold 29 | remote = cyan bold 30 | 31 | [color "diff"] 32 | meta = yellow bold 33 | frag = magenta bold 34 | old = red bold 35 | new = green bold 36 | whitespace = red reverse 37 | 38 | [color "status"] 39 | added = green bold 40 | changed = yellow bold 41 | untracked = red bold 42 | 43 | [alias] 44 | ############# 45 | aliases = config --get-regexp alias 46 | a = add --all 47 | ai = add -i 48 | ############# 49 | ap = apply 50 | as = apply --stat 51 | ac = apply --check 52 | ############# 53 | ama = am --abort 54 | amr = am --resolved 55 | ams = am --skip 56 | ############# 57 | b = branch 58 | ba = branch -a 59 | bd = branch -d 60 | br = branch -r 61 | ############# 62 | c = commit 63 | ca = commit -a 64 | cm = commit -m 65 | cam = commit -am 66 | cd = commit --amend 67 | cp = cherry-pick 68 | ############# 69 | d = diff 70 | dm = "!git branch --merged | grep -v '\\*' | xargs -n 1 git branch -d" 71 | ############# 72 | f = fetch 73 | fo = fetch origin 74 | fu = fetch upstream 75 | ############# 76 | fp = format-patch 77 | ############# 78 | g = grep -p 79 | ############# 80 | ls = ls-files 81 | lsf = "!git ls-files | grep -i" 82 | ############# 83 | m = merge 84 | ma = merge --abort 85 | mc = merge --continue 86 | ms = merge --skip 87 | ############# 88 | co = checkout 89 | cob = checkout -b 90 | com = checkout master 91 | ############# 92 | pr = prune -v 93 | ############# 94 | ps = push 95 | psf = push -f 96 | psu = push -u 97 | pso = push origin 98 | psao = push --all origin 99 | psfo = push -f origin 100 | psuo = push -u origin 101 | psom = push origin master 102 | psuom = push -u origin master 103 | ############# 104 | pl = pull 105 | plu = pull -u 106 | plo = pull origin 107 | plp = pull upstream 108 | plom = pull origin master 109 | ############# 110 | pb = pull --rebase 111 | pbo = pull --rebase origin 112 | pbp = pull --rebase upstream 113 | pbom = pull --rebase origin master 114 | pbpm = pull --rebase upstream master 115 | ############# 116 | rb = rebase 117 | rba = rebase --abort 118 | rbc = rebase --continue 119 | rbi = rebase --interactive 120 | rbs = rebase --skip 121 | ############# 122 | re = reset 123 | rh = reset HEAD 124 | reh = reset --hard 125 | res = reset --soft 126 | rehh = reset --hard HEAD 127 | resh = reset --soft HEAD 128 | ############# 129 | r = remote 130 | ra = remote add 131 | rr = remote rm 132 | rv = remote -v 133 | rm = remote rename 134 | rs = remote show 135 | rao = remote add origin 136 | rso = remote show origin 137 | ############# 138 | s = status 139 | sb = status -s -b 140 | wh 141 | -------------------------------------------------------------------------------- /config/.gitignore: -------------------------------------------------------------------------------- 1 | /.buildpath 2 | /build/ 3 | */archive/ 4 | 5 | __MACOSX 6 | .DS_Store 7 | 8 | .project 9 | .settings 10 | .classpath 11 | .sass-cache/ 12 | 13 | # OS generated files # 14 | ###################### 15 | */.DS_Store 16 | .DS_Store 17 | .DS_Store? 18 | ._* 19 | .Spotlight-V100 20 | .Trashes 21 | Icon? 22 | thumbs.db 23 | Thumbs.db 24 | -------------------------------------------------------------------------------- /config/.osx: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | 3 | COMPUTERNAME="YOUR NAME's MBP" 4 | HOSTNAME='mbp' 5 | LOCALHOSTNAME='mbp' 6 | 7 | sudo -v 8 | 9 | # Keep-alive: update existing `sudo` time stamp until `.osx` has finished 10 | while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null & 11 | 12 | ############################################################################### 13 | # General UI/UX # 14 | ############################################################################### 15 | 16 | # Disable the sound effects on boot 17 | sudo nvram SystemAudioVolume=" " 18 | 19 | # Set sidebar icon size to medium 20 | defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 2 21 | 22 | # Always show scrollbars when scrolling 23 | defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling" 24 | 25 | # Save to disk (not to iCloud) by default 26 | defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false 27 | 28 | # Automatically quit printer app once the print jobs complete 29 | defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true 30 | 31 | # Disable “Are you sure you want to open this application?” dialog 32 | defaults write com.apple.LaunchServices LSQuarantine -bool false 33 | 34 | # Remove duplicates in the “Open With” menu (also see `lscleanup` alias) 35 | /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 36 | 37 | # Reveal IP address, hostname, OS version, etc. when clicking the clock in login 38 | sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName 39 | 40 | # Restart automatically if the computer freezes 41 | sudo systemsetup -setrestartfreeze on 42 | 43 | # Check for software updates daily, not just once per week 44 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 45 | 46 | ############################################################################### 47 | # Trackpad, mouse, keyboard, Bluetooth accessories, and input # 48 | ############################################################################### 49 | 50 | # Trackpad: enable tap to click for this user and for the login screen 51 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true 52 | defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 53 | defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 54 | 55 | # Trackpad: map bottom right corner to right-click 56 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 57 | defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true 58 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 59 | defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true 60 | 61 | # Disable “natural” (Lion-style) scrolling 62 | defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false 63 | 64 | # Increase sound quality for Bluetooth headphones/headsets 65 | defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40 66 | 67 | # Enable full keyboard access for all controls 68 | # (e.g. enable Tab in modal dialogs) 69 | defaults write NSGlobalDomain AppleKeyboardUIMode -int 3 70 | 71 | # Disable press-and-hold for keys in favor of key repeat 72 | defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false 73 | 74 | # Set a blazingly fast keyboard repeat rate 75 | defaults write NSGlobalDomain KeyRepeat -int 0 76 | 77 | ############################################################################### 78 | # Screen # 79 | ############################################################################### 80 | 81 | # Require password immediately after sleep or screen saver begins 82 | defaults write com.apple.screensaver askForPassword -int 1 83 | defaults write com.apple.screensaver askForPasswordDelay -int 0 84 | 85 | # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF) 86 | defaults write com.apple.screencapture type -string "png" 87 | 88 | ############################################################################### 89 | # Finder # 90 | ############################################################################### 91 | 92 | # Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons 93 | defaults write com.apple.finder QuitMenuItem -bool true 94 | 95 | # Show icons for hard drives, servers, and removable media on the desktop 96 | defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true 97 | defaults write com.apple.finder ShowMountedServersOnDesktop -bool true 98 | defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true 99 | 100 | # Finder: show hidden files by default 101 | #defaults write com.apple.finder AppleShowAllFiles -bool true 102 | 103 | # Finder: show all filename extensions 104 | defaults write NSGlobalDomain AppleShowAllExtensions -bool true 105 | 106 | # Finder: show status bar 107 | defaults write com.apple.finder ShowStatusBar -bool true 108 | 109 | # When performing a search, search the current folder by default 110 | defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" 111 | 112 | # Disable the warning when changing a file extension 113 | defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false 114 | 115 | # Enable spring loading for directories 116 | defaults write NSGlobalDomain com.apple.springing.enabled -bool true 117 | 118 | # Remove the spring loading delay for directories 119 | defaults write NSGlobalDomain com.apple.springing.delay -float 0 120 | 121 | # Avoid creating .DS_Store files on network & USB volumes 122 | defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true 123 | defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true 124 | 125 | # Automatically open a new Finder window when a volume is mounted 126 | defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true 127 | defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true 128 | defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true 129 | 130 | # Disable the warning before emptying the Trash 131 | defaults write com.apple.finder WarnOnEmptyTrash -bool false 132 | 133 | # Enable AirDrop over Ethernet and on unsupported Macs running Lion 134 | defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true 135 | 136 | # Show the ~/Library folder 137 | chflags nohidden ~/Library 138 | 139 | # Show the /Volumes folder 140 | sudo chflags nohidden /Volumes 141 | 142 | # Remove Dropbox’s green checkmark icons in Finder 143 | file=/Applications/Dropbox.app/Contents/Resources/emblem-dropbox-uptodate.icns 144 | [ -e "${file}" ] && mv -f "${file}" "${file}.bak" 145 | 146 | # Expand the following File Info panes: 147 | # “General”, “Open with”, and “Sharing & Permissions” 148 | defaults write com.apple.finder FXInfoPanesExpanded -dict \ 149 | General -bool true \ 150 | OpenWith -bool true \ 151 | Privileges -bool true 152 | 153 | ############################################################################### 154 | # Dock, Dashboard, and hot corners # 155 | ############################################################################### 156 | 157 | # Enable highlight hover effect for the grid view of a stack (Dock) 158 | defaults write com.apple.dock mouse-over-hilite-stack -bool true 159 | 160 | # Change minimize/maximize window effect 161 | defaults write com.apple.dock mineffect -string "scale" 162 | 163 | # Minimize windows into their application’s icon 164 | defaults write com.apple.dock minimize-to-application -bool true 165 | 166 | # Enable spring loading for all Dock items 167 | defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true 168 | 169 | # Show indicator lights for open applications in the Dock 170 | defaults write com.apple.dock show-process-indicators -bool true 171 | 172 | # Speed up Mission Control animations 173 | defaults write com.apple.dock expose-animation-duration -float 0.1 174 | 175 | # Don’t group windows by application in Mission Control 176 | # (i.e. use the old Exposé behavior instead) 177 | defaults write com.apple.dock expose-group-by-app -bool false 178 | 179 | # Disable Dashboard 180 | defaults write com.apple.dashboard mcx-disabled -bool true 181 | 182 | # Don’t show Dashboard as a Space 183 | defaults write com.apple.dock dashboard-in-overlay -bool true 184 | 185 | # Don’t automatically rearrange Spaces based on most recent use 186 | defaults write com.apple.dock mru-spaces -bool false 187 | 188 | # Make Dock icons of hidden applications translucent 189 | defaults write com.apple.dock showhidden -bool true 190 | 191 | ############################################################################### 192 | # Spotlight # 193 | ############################################################################### 194 | 195 | defaults write com.apple.spotlight orderedItems -array \ 196 | '{"enabled" = 1;"name" = "APPLICATIONS";}' \ 197 | '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ 198 | '{"enabled" = 1;"name" = "DIRECTORIES";}' \ 199 | '{"enabled" = 1;"name" = "PDF";}' \ 200 | '{"enabled" = 1;"name" = "FONTS";}' \ 201 | '{"enabled" = 0;"name" = "DOCUMENTS";}' \ 202 | '{"enabled" = 0;"name" = "MESSAGES";}' \ 203 | '{"enabled" = 0;"name" = "CONTACT";}' \ 204 | '{"enabled" = 0;"name" = "EVENT_TODO";}' \ 205 | '{"enabled" = 0;"name" = "IMAGES";}' \ 206 | '{"enabled" = 0;"name" = "BOOKMARKS";}' \ 207 | '{"enabled" = 0;"name" = "MUSIC";}' \ 208 | '{"enabled" = 0;"name" = "MOVIES";}' \ 209 | '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ 210 | '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ 211 | '{"enabled" = 0;"name" = "SOURCE";}' \ 212 | '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \ 213 | '{"enabled" = 0;"name" = "MENU_OTHER";}' \ 214 | '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \ 215 | '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ 216 | '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ 217 | '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' 218 | 219 | # Load new settings before rebuilding the index 220 | killall mds > /dev/null 2>&1 221 | # Make sure indexing is enabled for the main volume 222 | sudo mdutil -i on / > /dev/null 223 | # Rebuild the index from scratch 224 | sudo mdutil -E / > /dev/null 225 | 226 | ############################################################################### 227 | # Terminal & iTerm 2 # 228 | ############################################################################### 229 | 230 | # Don’t display the annoying prompt when quitting iTerm 231 | defaults write com.googlecode.iterm2 PromptOnQuit -bool false 232 | 233 | ############################################################################### 234 | # Time Machine # 235 | ############################################################################### 236 | 237 | # Prevent Time Machine from prompting to use new hard drives as backup volume 238 | defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true 239 | 240 | # Disable local Time Machine backups 241 | hash tmutil &> /dev/null && sudo tmutil disablelocal 242 | 243 | ############################################################################### 244 | # Activity Monitor # 245 | ############################################################################### 246 | 247 | # Show the main window when launching Activity Monitor 248 | defaults write com.apple.ActivityMonitor OpenMainWindow -bool true 249 | 250 | # Visualize CPU usage in the Activity Monitor Dock icon 251 | defaults write com.apple.ActivityMonitor IconType -int 5 252 | 253 | # Show all processes in Activity Monitor 254 | defaults write com.apple.ActivityMonitor ShowCategory -int 0 255 | 256 | # Sort Activity Monitor results by CPU usage 257 | defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage" 258 | defaults write com.apple.ActivityMonitor SortDirection -int 0 259 | 260 | ############################################################################### 261 | # Address Book, Dashboard, iCal, TextEdit, and Disk Utility # 262 | ############################################################################### 263 | 264 | # Enable the debug menu in Address Book 265 | defaults write com.apple.addressbook ABShowDebugMenu -bool true 266 | 267 | # Enable Dashboard dev mode (allows keeping widgets on the desktop) 268 | defaults write com.apple.dashboard devmode -bool true 269 | 270 | # Enable the debug menu in iCal (pre-10.8) 271 | defaults write com.apple.iCal IncludeDebugMenu -bool true 272 | 273 | # Use plain text mode for new TextEdit documents 274 | defaults write com.apple.TextEdit RichText -int 0 275 | # Open and save files as UTF-8 in TextEdit 276 | defaults write com.apple.TextEdit PlainTextEncoding -int 4 277 | defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 278 | 279 | # Enable the debug menu in Disk Utility 280 | defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true 281 | defaults write com.apple.DiskUtility advanced-image-options -bool true 282 | 283 | ############################################################################### 284 | # Mac App Store # 285 | ############################################################################### 286 | 287 | # Enable the WebKit Developer Tools in the Mac App Store 288 | defaults write com.apple.appstore WebKitDeveloperExtras -bool true 289 | 290 | # Enable Debug Menu in the Mac App Store 291 | defaults write com.apple.appstore ShowDebugMenu -bool true 292 | 293 | # Enable the automatic update check 294 | defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true 295 | 296 | # Check for software updates daily, not just once per week 297 | defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 298 | 299 | # Download newly available updates in background 300 | defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1 301 | 302 | # Install System data files & security updates 303 | defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1 304 | 305 | # Automatically download apps purchased on other Macs 306 | defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1 307 | 308 | # Turn on app auto-update 309 | defaults write com.apple.commerce AutoUpdate -bool true 310 | 311 | # Allow the App Store to reboot machine on macOS updates 312 | defaults write com.apple.commerce AutoUpdateRestartRequired -bool true 313 | 314 | ############################################################################### 315 | # Messages # 316 | ############################################################################### 317 | 318 | # Disable smart quotes as it’s annoying for messages that contain code 319 | defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false 320 | 321 | ############################################################################### 322 | # Google Chrome # 323 | ############################################################################### 324 | 325 | # Allow installing user scripts via GitHub Gist or Userscripts.org 326 | defaults write com.google.Chrome ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 327 | defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://gist.githubusercontent.com/" "http://userscripts.org/*" 328 | 329 | # Disable the all too sensitive backswipe on trackpads 330 | defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool false 331 | defaults write com.google.Chrome.canary AppleEnableSwipeNavigateWithScrolls -bool false 332 | 333 | # Disable the all too sensitive backswipe on Magic Mouse 334 | defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false 335 | defaults write com.google.Chrome.canary AppleEnableMouseSwipeNavigateWithScrolls -bool false 336 | 337 | # Use the system-native print preview dialog 338 | defaults write com.google.Chrome DisablePrintPreview -bool true 339 | defaults write com.google.Chrome.canary DisablePrintPreview -bool true 340 | 341 | # Expand the print dialog by default 342 | defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true 343 | defaults write com.google.Chrome.canary PMPrintingExpandedStateForPrint2 -bool true 344 | 345 | ############################################################################### 346 | # Transmission.app # 347 | ############################################################################### 348 | 349 | # Use `~/Downloads/Torrents` to store incomplete downloads 350 | defaults write org.m0k.transmission UseIncompleteDownloadFolder -bool true 351 | defaults write org.m0k.transmission IncompleteDownloadFolder -string "${HOME}/Documents/Torrents" 352 | 353 | # Don’t prompt for confirmation before downloading 354 | defaults write org.m0k.transmission DownloadAsk -bool false 355 | 356 | # Trash original torrent files 357 | defaults write org.m0k.transmission DeleteOriginalTorrent -bool true 358 | 359 | # Hide the donate message 360 | defaults write org.m0k.transmission WarningDonate -bool false 361 | # Hide the legal disclaimer 362 | defaults write org.m0k.transmission WarningLegal -bool false 363 | 364 | ############################################################################### 365 | # Kill affected applications # 366 | ############################################################################### 367 | 368 | for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \ 369 | "Dock" "Finder" "Google Chrome" "Messages" \ 370 | "Photos" "SystemUIServer" "Terminal" \ 371 | "Transmission" "iCal"; do 372 | killall "${app}" &> /dev/null 373 | done 374 | echo "Done. Note that some of these changes require a logout/restart to take effect." 375 | -------------------------------------------------------------------------------- /installs/brew_installs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function require_brew() { 4 | running "brew cask install $1 $2" 5 | brew list $1 > /dev/null 2>&1 | true 6 | if [[ ${PIPESTATUS[0]} != 0 ]]; then 7 | action "brew install $1" 8 | brew install $1 $2 9 | if [[ $? != 0 ]]; then 10 | error "failed to install $1! aborting..." 11 | exit -1 12 | fi 13 | fi 14 | ok 15 | } 16 | 17 | function cask_install() { 18 | running "brew cask $1" 19 | brew cask search $1 > /dev/null 2>&1 | true 20 | if [[ ${PIPESTATUS[0]} != 0 ]]; then 21 | action "brew cask install $1 $2" 22 | brew cask install $1 $2 23 | if [[ $? != 0 ]]; then 24 | error "failed to install $1! aborting..." 25 | exit -1 26 | fi 27 | fi 28 | ok 29 | } 30 | 31 | ########## BREW PKGS ########## 32 | running "installing python" 33 | require_brew python 34 | 35 | running "installing rvm" 36 | require_brew rvm 37 | 38 | running "installing zsh" 39 | require_brew zsh 40 | 41 | yes_or_no "would you like to install fontconfig?" 42 | if confirmed; then 43 | require_brew fontconfig 44 | fi 45 | 46 | ########## APPS ########### 47 | running "installing brew cask" 48 | brew tap caskroom/cask 49 | 50 | #### DEVELOPMENT #### 51 | yes_or_no "would you like to install iterm?" 52 | if confirmed; then 53 | cask_install iterm2 54 | fi 55 | 56 | yes_or_no "would you like to install VSCode?" 57 | if confirmed; then 58 | cask_install visual-studio-code 59 | fi 60 | 61 | #### MEDIA #### 62 | yes_or_no "would you like to install vlc?" 63 | if confirmed; then 64 | cask_install vlc 65 | fi 66 | 67 | yes_or_no "would you like to install spotify?" 68 | if confirmed; then 69 | cask_install spotify 70 | fi 71 | 72 | yes_or_no "would you like to install transmission?" 73 | if confirmed; then 74 | cask_install transmission 75 | fi 76 | 77 | #### COMMUNICATION #### 78 | yes_or_no "would you like to install slack?" 79 | if confirmed; then 80 | cask_install slack 81 | fi 82 | 83 | #### MISC #### 84 | yes_or_no "would you like to install google chrome?" 85 | if confirmed; then 86 | cask_install google-chrome 87 | fi 88 | 89 | yes_or_no "would you like to install docker toolbox?" 90 | if confirmed; then 91 | cask_install dockertoolbox 92 | fi 93 | 94 | yes_or_no "would you like to install flux?" 95 | if confirmed; then 96 | cask_install flux 97 | fi 98 | 99 | yes_or_no "would you like to install dropbox?" 100 | if confirmed; then 101 | cask_install dropbox 102 | fi 103 | 104 | #### SECURITY #### 105 | yes_or_no "would you like to install 1password?" 106 | if confirmed; then 107 | cask_install 1password 108 | fi 109 | 110 | running "cleaning up cask files" 111 | brew cask cleanup 112 | 113 | bot "chosen brew and brew cask packages installed successfully" 114 | -------------------------------------------------------------------------------- /installs/gem_installs: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function require_gem() { 4 | running "gem $1" 5 | if [[ $(gem list --local | grep $1 | head -1 | cut -d' ' -f1) != $1 ]]; 6 | then 7 | action "gem install $1" 8 | gem install $1 9 | fi 10 | ok 11 | } 12 | 13 | running "installing bundler" 14 | require_gem bundler 15 | 16 | running "installing rails" 17 | require_gem rails 18 | 19 | bot "gems installed successfully" 20 | -------------------------------------------------------------------------------- /resources.sh: -------------------------------------------------------------------------------- 1 | #! Colors 2 | ESC_SEQ="\x1b[" 3 | COL_RESET=$ESC_SEQ"39;49;00m" 4 | COL_RED=$ESC_SEQ"31;01m" 5 | COL_GREEN=$ESC_SEQ"32;01m" 6 | COL_YELLOW=$ESC_SEQ"33;01m" 7 | COL_MAGENTA=$ESC_SEQ"35;01m" 8 | COL_CYAN=$ESC_SEQ"36;01m" 9 | 10 | function ok() { 11 | echo -e "$COL_GREEN [ok]$COL_RESET "$1 12 | } 13 | 14 | function bot() { 15 | echo -e "\n$COL_GREEN\[._.]/$COL_RESET - "$1 16 | } 17 | 18 | function running() { 19 | echo -e "$COL_CYAN ⇒ $COL_RESET "$1": " 20 | } 21 | 22 | function action() { 23 | echo -e "\n$COL_YELLOW [action]:$COL_RESET\n ⇒ $1" 24 | } 25 | 26 | function warn() { 27 | echo -e "$COL_YELLOW [warning]$COL_RESET "$1 28 | } 29 | 30 | function error() { 31 | echo -e "$COL_RED [error]$COL_RESET "$1 32 | } 33 | 34 | function yes_or_no() { 35 | echo -n "\n$COL_MAGENTA $1 $COL_RESET(y/n) " 36 | read response 37 | } 38 | 39 | function confirmed() { 40 | if [[ "$response" =~ ^[Yy]$ ]]; then 41 | return 0 42 | fi 43 | return 1 44 | } 45 | 46 | function set_computer_info() { 47 | echo -e "$COL_MAGENTA Enter your computer name$COL_RESET: " 48 | read cpname 49 | 50 | sudo scutil --set ComputerName "$cpname" 51 | sudo scutil --set HostName "$cpname" 52 | sudo scutil --set LocalHostName "$cpname" 53 | defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string "$cpname" 54 | } 55 | 56 | function set_git_info() { 57 | echo -n "\n$COL_MAGENTA set your github username$COL_RESET: " 58 | read name 59 | echo -n "\n$COL_MAGENTA set your github email$COL_RESET: " 60 | read email 61 | 62 | git config --global user.name $name 63 | git config --global user.email $email 64 | } 65 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env zsh 2 | source resources.sh 3 | 4 | bot "hello! welcome to your new computer" 5 | bot "let's get going! " 6 | 7 | bot "installing osx command line tools" 8 | xcode-select --install 9 | 10 | # set computer info 11 | set_computer_info 12 | 13 | # make dotfiles hidden 14 | running "hiding dotfiles" 15 | mv /dotfiles ~/.dotfiles 16 | ok 17 | 18 | # install brew 19 | running "installing brew" 20 | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 21 | 22 | if [[ $? != 0 ]]; then 23 | error "unable to install homebrew -> quitting setup" 24 | exit 2 25 | fi 26 | 27 | running "updating to most recent brew version" 28 | brew doctor 29 | brew update 30 | ok 31 | 32 | # install node 33 | running "installing node" 34 | curl "https://nodejs.org/dist/latest/node-${VERSION:-$(wget -qO- https://nodejs.org/dist/latest/ | sed -nE 's|.*>node-(.*)\.pkg.*|\1|p')}.pkg" > "$HOME/Downloads/node-latest.pkg" && sudo installer -store -pkg "$HOME/Downloads/node-latest.pkg" -target "/" 35 | if [[ $? != 0 ]]; then 36 | error "unable to install node -> quitting setup" 37 | exit 2 38 | fi 39 | ok 40 | 41 | running "Select which bundled brew & brew-cask packages you want to install" 42 | source installs/.brew_installs 43 | ok "feel free to add more brew packages! " 44 | 45 | # globally install key npm pkgs 46 | running "Select which bundled npm modules you want to install" 47 | source installs/.npm_installs 48 | ok "feel free to add more npm modules! " 49 | 50 | # globally install important gems 51 | running "Select which bundled gems you want to install" 52 | source installs/.gem_installs 53 | ok "feel free to add more ruby gems! " 54 | 55 | #globally install atom packages 56 | running "select the atom packages you would like to install" 57 | source installs/.apm_installs 58 | ok "feel free to add more atom packages! " 59 | 60 | # hard link .zshrc 61 | running "linking your .zshrc!" 62 | ln ~/.dotfiles/.zshrc ~/.zshrc 63 | ok 64 | 65 | running "downloading oh-my-zsh" 66 | sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" 67 | 68 | if [[ $? != 0 ]]; then 69 | error "unable to install oh-my-zsh -> quitting setup" 70 | exit 2 71 | fi 72 | ok 73 | 74 | # hard link .oh-my-zsh 75 | running "linking .oh-my-zsh" 76 | ln ~/.oh-my-zsh ~/.dotfiles/zsh/.oh-my-zsh 77 | ok 78 | 79 | # hard link .gitconfig 80 | running "linking .gitconfig" 81 | ln ~/.dotfiles/.gitconfig ~/.gitconfig 82 | ok 83 | 84 | # setup git credentials 85 | yes_or_no "Would you like to set your git credentials now?" 86 | if confirmed; then 87 | set_git_info 88 | else 89 | bot "ok, but remember to do it before your first commit! " 90 | fi 91 | 92 | bot "setting zsh as the user shell" 93 | CURRENTSHELL=$(dscl . -read /Users/$USER UserShell | awk '{print $2}') 94 | if [[ "$CURRENTSHELL" != "/usr/local/bin/zsh" ]]; then 95 | bot "setting newer homebrew zsh (/usr/local/bin/zsh) as your shell (password required)" 96 | sudo dscl . -change /Users/$USER UserShell $SHELL /usr/local/bin/zsh > /dev/null 2>&1 97 | ok 98 | fi 99 | 100 | running "sourcing zshrc" 101 | source ~/.zshrc 102 | ok 103 | 104 | running "sourcing osx defaults" 105 | source .osx 106 | ok 107 | 108 | bot "whooo, all set! " 109 | -------------------------------------------------------------------------------- /zsh_files/.aliases: -------------------------------------------------------------------------------- 1 | #!bin/bash 2 | 3 | alias back="cd .." 4 | alias home="cd ~" 5 | 6 | # folder shortcuts 7 | alias dl="cd ~/Downloads" 8 | alias dt="cd ~/Desktop" 9 | alias dv="cd ~/Developer" 10 | 11 | # reload zsh config 12 | alias reload!='. ~/.zshrc' 13 | 14 | alias cls='clear' 15 | 16 | alias spotoff="sudo mdutil -a -i off" # Disable Spotlight 17 | alias spoton="sudo mdutil -a -i on" # Enable Spotlight 18 | 19 | ############### MISCELLANEOUS ############### 20 | 21 | #update OS software, ruby, brew, npm, and their installed packages 22 | alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm install npm -g; npm update -g; sudo gem update --system; sudo gem update; sudo gem cleanup' 23 | 24 | alias python="python3" 25 | alias pip="pip3" 26 | 27 | # JavaScriptCore REPL 28 | jscbin="/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc"; 29 | [ -e "${jscbin}" ] && alias jsc="${jscbin}"; 30 | unset jscbin; 31 | 32 | # trim new lines and copy to clipboard 33 | alias c="tr -d '\n' | pbcopy" 34 | 35 | alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'" 36 | 37 | # View HTTP traffic 38 | alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" 39 | alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" 40 | 41 | #get IP address 42 | alias localip="ipconfig getifaddr en0" 43 | 44 | #lock the screen 45 | alias lksc="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" 46 | 47 | # volume 48 | alias stfu="osascript -e 'set volume output muted true'" 49 | alias uptop="osascript -e 'set volume output volume 100'" 50 | 51 | #recursively delete DS_Store files 52 | alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" 53 | -------------------------------------------------------------------------------- /zsh_files/.functions: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # make a directory then cd into it 4 | function mkd() { 5 | mkdir -p "$@" && cd "$_"; 6 | } 7 | 8 | # update all the things 9 | update() { 10 | local brew="brew update; brew upgrade;" 11 | local gisty="gisty pull_all; gisty sync_delete" 12 | local gem="gem update;" 13 | local pip="pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs pip install -U -q" 14 | sh -c $brew$gisty; sudo sh -c $gem$pip 15 | } 16 | 17 | # change directory to the current Finder directory 18 | cdf() { 19 | target=`osascript -e 'tell application "Finder" to if (count of Finder windows) > 0 then get POSIX path of (target of front Finder window as text)'` 20 | if [ "$target" != "" ]; then 21 | cd "$target"; pwd 22 | else 23 | echo 'No Finder window found' >&2 24 | fi 25 | } 26 | 27 | # use Git’s colored diff when available 28 | hash git &>/dev/null; 29 | if [ $? -eq 0 ]; then 30 | function diff() { 31 | git diff --no-index --color-words "$@"; 32 | } 33 | fi; 34 | 35 | # Syntax-highlight JSON strings or files 36 | # Usage: `json '{"foo":42}'` or `echo '{"foo":42}' | json` 37 | function json() { 38 | if [ -t 0 ]; then # argument 39 | python -mjson.tool <<< "$*" | pygmentize -l javascript; 40 | else # pipe 41 | python -mjson.tool | pygmentize -l javascript; 42 | fi; 43 | } 44 | 45 | # `o` with no arguments opens the current directory, otherwise opens the given 46 | # location 47 | function o() { 48 | if [ $# -eq 0 ]; then 49 | open .; 50 | else 51 | open "$@"; 52 | fi; 53 | } 54 | 55 | # toggle dotfiles shown vs hidden 56 | function toggle_dotfiles(){ 57 | if [ ! -z "$1" ]; then 58 | show_dotfiles=$1 59 | else 60 | DOTFILE_STATE=$(defaults read com.apple.finder AppleShowAllFiles) 61 | if [ "${DOTFILE_STATE}" == "1" ]; then 62 | show_dotfiles="FALSE" 63 | else 64 | show_dotfiles="TRUE" 65 | fi 66 | fi 67 | 68 | defaults write com.apple.finder AppleShowAllFiles $show_dotfiles 69 | killall Finder 70 | } 71 | 72 | # prints path to app 73 | function whichapp() { 74 | local appNameOrBundleId=$1 isAppName=0 bundleId 75 | [[ $appNameOrBundleId =~ \.[aA][pP][pP]$ || $appNameOrBundleId =~ ^[^.]+$ ]] && isAppName=1 76 | if (( isAppName )); then 77 | bundleId=$(osascript -e "id of application \"$appNameOrBundleId\"" 2>/dev/null) || 78 | { echo "$FUNCNAME: ERROR: Application with specified name not found: $appNameOrBundleId" 1>&2; return 1; } 79 | else 80 | bundleId=$appNameOrBundleId 81 | fi 82 | osascript -e "tell application \"Finder\" to POSIX path of (get application file id \"$bundleId\" as alias)" 2>/dev/null || 83 | { echo "$FUNCNAME: ERROR: Application with specified bundle ID not found: $bundleId" 1>&2; return 1; } 84 | } 85 | --------------------------------------------------------------------------------