Skip to content

Instantly share code, notes, and snippets.

@marklawlor
Last active September 21, 2016 14:39
Show Gist options
  • Save marklawlor/4ecb7d4c06044e17b683 to your computer and use it in GitHub Desktop.
Save marklawlor/4ecb7d4c06044e17b683 to your computer and use it in GitHub Desktop.
WIP Helper script to setup Mac OSX from a clean install
#!/bin/bash
#
# Helper functions
#
function pause(){
read -p "$*"
}
#
# XCode install
#
# Install xcode
touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress;
PROD=$(softwareupdate -l |
grep "\*.*Command Line" |
head -n 1 | awk -F"*" '{print $2}' |
sed -e 's/^ *//' |
tr -d '\n')
softwareupdate -i "$PROD" -v;
# Verify install
gcc --install;
pause 'Verify Xcode was installed correctly and press [Enter] key to continue...';
#
# Homebrew install
#
# Check for Homebrew,
# Install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi
brew update; brew; brew install caskroom/cask/brew-cask; brew doctor
pause 'Verify Brew was installed correctly and press [Enter] key to continue...'
#
# OSX Utility Install
#
# echo "installing OSX utilities..."
# # Install GNU core utilities (those that come with OS X are outdated)
# brew install coreutils
# # Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
# brew install findutils
# # Install Bash 4
# brew install bash
# # Install more recent versions of some OS X tools
# brew tap homebrew/dupes
# brew install homebrew/dupes/grep
# # Install Services
# brew tap homebrew/services
# #
# # Binaries Install
# #
# binaries=(
# python
# git
# zsh
# ack
# vim
# macvim
# nvm
# the_silver_searcher
# tmux
# reattach-to-user-namespace
# mysql
# redis
# nginx
# mycli
# pgcli
# mopidy
# mopidy-spotify
# ncmpcpp
# bash-completion
# java
# )
# echo "installing binaries..."
# brew install ${binaries[@]}
# brew linkapps
# brew cleanup
# touch ~/.zshrc
# # NVM
# mkdir ~/.nvm; cp $(brew --prefix nvm)/nvm-exec ~/.nvm/; echo 'export NVM_DIR=~/.nvm' >> $HOME/.zshrc; echo 'source $(brew --prefix nvm)/nvm.sh' >> $HOME/.bash_profile;
# nvm install 0.12; nvm use 0.12; nvm alias default 0.12; node -v && npm -v;
# pause 'Verify Node versions are correct'
# # NPM
# npm completion > ~/.bash/npm-completion.bash
# printf '\n\nif [ -f ~/.bash/npm-completion.sh ]; then\n\tsource ~/.bash/npm-completion.sh\nfi\n' >> $HOME/.bash_profile
# # Bash completion
# printf '\n\nif [ -f `brew --prefix`/etc/bash_completion ]; then\n\t. `brew --prefix`/etc/bash_completion\nfi' >> $HOME/.bash_profile
# #
# # Application Install
# #
# brew install caskroom/cask/brew-cask
# brew tap caskroom/versions
# # Apps
# apps=(
# dropbox
# google-chrome
# firefox
# spotify
# iterm2
# sublime-text3
# virtualbox
# atom
# flux
# vlc
# transmission
# sequel-pro
# gitkraken
# )
# # Install apps to /Applications
# # Default is: /Users/$user/Applications
# echo "installing apps..."
# brew cask install ${apps[@]}
# # Post App Setup
# #
# # Setup Bash
# #
# echo "installing zsh..."
# # Setup zsh as a shell
# echo "/usr/local/bin/zsh" | sudo tee -a /etc/shells
# # Make default shell
# chsh -s /usr/local/bin/zsh
# # Install oh-my-zsh
# curl -L http://install.ohmyz.sh | sh
# # Enable oh-my-zsh plugins
# echo "plugins=(git brew npm)" >> ~/.zshrc
# # Syntax highlighting for zsh
# cd ~/.oh-my-zsh && git clone git://github.com/zsh-users/zsh-syntax-highlighting.git
# echo "source ~/.oh-my-zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> ~/.zshrc
# source ~/.zshrc
# # Add Z to zsh
# echo ". `brew --prefix`/etc/profile.d/z.sh" >> ~/.zshrc
# # cleanup
# brew cleanup --force
# rm -f -r /Library/Caches/Homebrew/*
# # SSH Keys
# ssh-keygen -t rsa -b 4096 -C "[email protected]"
# # Docker
# brew cask install docker
# cd /usr/local/etc/bash_completion.d
# ln -s /Applications/Docker.app/Contents/Resources/etc/docker.bash-completion
# ln -s /Applications/Docker.app/Contents/Resources/etc/docker-machine.bash-completion
# ln -s /Applications/Docker.app/Contents/Resources/etc/docker-compose.bash-completion
# # References
# # http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
# # http://jilles.me/badassify-your-terminal-and-shell/
@marklawlor
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment