-
-
Save vskintiian/16d83e906fa3d32a1e0fdf0a04818b7c to your computer and use it in GitHub Desktop.
Script to prepare a new OSX machine for work
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # | |
| # Bootstrap script for setting up a new OSX machine | |
| # | |
| # This should be idempotent so it can be run multiple times. | |
| # | |
| # Some apps don't have a cask and so still need to be installed by hand. These | |
| # include: | |
| # | |
| # - Twitter (app store) | |
| # - Postgres.app (http://postgresapp.com/) | |
| # | |
| # Notes: | |
| # | |
| # - If installing full Xcode, it's better to install that first from the app | |
| # store before running the bootstrap script. Otherwise, Homebrew can't access | |
| # the Xcode libraries as the agreement hasn't been accepted yet. | |
| echo "Starting bootstrapping..." | |
| # Check for Homebrew, install if we don't have it | |
| if test ! $(which brew); then | |
| echo "Installing homebrew..." | |
| ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| fi | |
| # Update && upgrade homebrew recipes | |
| brew update | |
| brew upgrade | |
| # Install GNU core utilities (those that come with OS X are outdated) | |
| brew tap homebrew/dupes | |
| brew install coreutils | |
| brew install gnu-tar --with-default-names | |
| brew install gnu-indent --with-default-names | |
| brew install gnu-which --with-default-names | |
| brew install gnu-grep --with-default-names | |
| # Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed | |
| brew install findutils | |
| # Install Bash 4 | |
| brew install bash | |
| # Before starting, make sure xcode command line tools is installed | |
| brew install gcc | |
| xcode-select --install | |
| PACKAGES=( | |
| git | |
| markdown | |
| tree | |
| wget | |
| carthage | |
| ) | |
| echo "Installing packages..." | |
| brew install ${PACKAGES[@]} | |
| echo "Cleaning up..." | |
| brew cleanup | |
| echo "Installing cask..." | |
| brew install caskroom/cask/brew-cask | |
| CASKS=( | |
| dropbox | |
| cyberduck | |
| disk-inventory-x | |
| insomniax | |
| dash | |
| google-chrome | |
| gpgtools | |
| iterm2 | |
| skype | |
| slack | |
| spectacle | |
| the-unarchiver | |
| virtualbox | |
| vlc | |
| wireshark | |
| evernote | |
| spotify | |
| sourcetree | |
| ichm | |
| google-backup-and-sync | |
| mas | |
| transmit | |
| mailbutler | |
| macdown | |
| rescuetime | |
| viber | |
| lepton | |
| tunnelbear | |
| postman | |
| skitch | |
| telegram-desktop | |
| sublime-text | |
| fish | |
| ) | |
| echo "Installing cask apps..." | |
| brew cask install ${CASKS[@]} | |
| echo "Installing fonts..." | |
| brew tap caskroom/fonts | |
| FONTS=( | |
| font-inconsolidata | |
| font-roboto | |
| font-clear-sans | |
| ) | |
| brew cask install ${FONTS[@]} | |
| echo "Installing apps from the AppStore using mas-cli..." | |
| echo "AppleID AppStore e-mail:" && read mas_email | |
| mas signin $mas_email | |
| mas upgrade | |
| APPS=( | |
| 333903271 #Twitter | |
| 497799835 # Xcode | |
| 1091189122 # Bear | |
| 926036361 # LastPass | |
| ) | |
| for app in ${APPS[@]}; do | |
| mas install ${app} | |
| done | |
| sudo xcodebuild -license accept | |
| echo "Installing Ruby gems" | |
| RUBY_GEMS=( | |
| bundler | |
| filewatcher | |
| cocoapods | |
| ) | |
| sudo gem install ${RUBY_GEMS[@]} | |
| git_current_user="$(git config --global --get user.email)" | |
| if [[ -z $git_current_user ]]; then | |
| echo "Configuring Git..." | |
| echo "Name:" && read git_name | |
| echo "E-mail:" && read git_email | |
| git config --global user.name "${git_name}" | |
| git config --global user.email ${git_email} | |
| fi | |
| echo "Configuring OSX defaults..." | |
| # Set fast key repeat rate | |
| defaults write NSGlobalDomain KeyRepeat -int 0 | |
| # Make hidden apps translucent | |
| defaults write com.apple.Dock showhidden -bool true | |
| # Hide desktop icons | |
| defaults write com.apple.finder CreateDesktop -bool false | |
| # Require password as soon as screensaver or sleep mode starts | |
| defaults write com.apple.screensaver askForPassword -int 1 | |
| defaults write com.apple.screensaver askForPasswordDelay -int 0 | |
| # Show filename extensions by default | |
| defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
| # Enable tap-to-click | |
| defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true | |
| defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
| # Disable "natural" scroll | |
| defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false | |
| echo "Creating folder structure..." | |
| if [[ ! -d ~/dev ]]; then | |
| mkdir -p ~/dev/workplace | |
| mkdir -p ~/dev/resources | |
| fi | |
| echo "Bootstrapping complete" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment