Skip to content

Instantly share code, notes, and snippets.

@shaunfink
Last active December 14, 2019 15:08
Show Gist options
  • Save shaunfink/4bdf2c3207c46f660060d18533b81cd1 to your computer and use it in GitHub Desktop.
Save shaunfink/4bdf2c3207c46f660060d18533b81cd1 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Useful script for setting up my mac
### Some useful links ###
# Mac Setup (https://sourabhbajaj.com/mac-setup)
# Install Python 3 (https://docs.python-guide.org/starting/install3/osx)
# Cloud Foundry tools (https://github.com/cloudfoundry/homebrew-tap)
# Other Useful CLI tools (https://stevenloria.com/python-clis)
# zsh Magic (https://rick.cogley.info/post/use-homebrew-zsh-instead-of-the-osx-default)
# https://medium.com/@caulfieldOwen/youre-missing-out-on-a-better-mac-terminal-experience-d73647abf6d7
# Install Ruby On Rails on Mac OS X (https://gorails.com/setup/osx/10.14-mojave)
# Gist CLI gem (http://defunkt.io/gist)
# Powerlevel9K Useful info (https://medium.com/the-code-review/make-your-terminal-more-colourful-and-productive-with-iterm2-and-zsh-11b91607b98c)
# Keeping your Mac Clean (https://medium.com/@waxzce/keeping-macos-clean-this-is-my-osx-brew-update-cli-command-6c8f12dc1731)
# Dotfiles (http://dotfiles.github.io)
# Install xcode cli tools
xcode-select --install
# Accept xcode license (if installed)
[ -f $( which xcodebuild ) ] && sudo xcodebuild -license accept
# Install Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# Add some more path variables
echo 'export PATH="$PATH:/usr/local/sbin"' >> ~/.profile
# Brew Taps
brew_taps=(\
'caskroom/cask' \
'phinze/homebrew-cask' \
'cloudfoundry/tap' \
'pivotal/tap' \
'puppetlabs/puppet' \
'caskroom/fonts' \
'sambadevi/powerlevel9k' \
'starkandwayne/cf' \
'homebrew/cask-drivers' \
)
for tap in ${brew_taps[@]}; do
brew tap $tap
done
# Install some default Homebrew Cask stuff
brew_cask_installs=(\
'android-file-transfer' \
'dropbox' \
'firefox' \
'google-chrome' \
'google-hangouts' \
'google-backup-and-sync' \
'google-earth-pro' \
'vlc' \
'atom' \
'vagrant' \
'vagrant-manager' \
'virtualbox' \
'docker-edge' \
'docker-toolbox' \
'iterm2' \
'pycharm-ce' \
'intellij-idea-ce' \
'adobe-creative-cloud' \
'adobe-dng-converter' \
'java8' \
'fly' \
'slack' \
'discord' \
'battle-net' \
'steam' \
'pdk' \
'font-hack-nerd-font' \
'zoomus' \
'franz' \
'skype' \
'whatsapp' \
'visual-studio-code' \
'postman' \
'razer-synapse' \
'sublime-text' \
'sublime-merge' \
'chromium' \
)
for cask in ${brew_cask_installs[@]}; do
brew cask install $cask
done
# Install some default Homebrew stuff
brew_installs=(\
'jq' \
'terraform' \
'cf-cli' \
'bosh-init' \
'bosh-cli' \
'credhub-cli' \
'bbl' \
'springboot' \
'autoenv' \
'python' \
'gnupg' \
'git' \
'git-flow' \
'zsh' \
'grails' \
'tmux' \
'tree' \
'ack' \
'packer' \
'bash' \
'vim' \
'ipython' \
'node' \
'go' \
'rbenv' \
'ruby-build' \
'rbenv-default-gems' \
'rbenv-gemset' \
'kubernetes-cli' \
'pivnet-cli' \
'yq' \
'vault-cli' \
'zsh-completions' \
'vagrant-completion' \
'tmuxinator-completion' \
'spring-completion' \
'ruby-completion' \
'rails-completion' \
'pip-completion' \
'packer-completion' \
'maven-completion' \
'gradle-completion' \
'gem-completion' \
'docker-completion' \
'docker-machine-completion' \
'docker-compose-completion' \
'django-completion' \
'brew-cask-completion' \
'bash-completion' \
'powerlevel9k' \
'maven' \
'mas' \
'om' \
's3cmd' \
'glide' \
'ipcalc' \
'netcat' \
'spruce' \
'ansible' \
'cowsay' \
'pack' \
'fortune' \
'cmatrix' \
'thefuck' \
'wget' \
'saltstack' \
'bat' \
)
for install in ${brew_installs[@]}; do
brew install $install
done
# Install some Node stuff
npm_installs=(\
'@angular/cli' \
)
for install in ${npm_installs[@]}; do
npm install -g $install
done
# Install some Python stuff
pip_installs=(\
'pipenv --user' \
'virtualenv' \
'requests' \
'virtualenvwrapper' \
'awscli' \
'cookiecutter' \
'konch' \
'setuptools' \
'pip' \
'pdbpp' \
'docker' \
'google-auth-oauthlib' \
'google-assistant-sdk' \
'google-assistant-grpc' \
)
eval \${pip_installs[@]}
IFS=$'\n'
for pip in ${pip_installs[@]}; do
pip3 install $pip --upgrade
done
unset IFS
# Add some path variables
echo 'export PATH="$HOME/.local/bin:~/Library/Python/$( ls -Art ~/Library/Python/ | tail -n 1 )/bin:$PATH"' >> ~/.profile
echo 'export GOPATH=$HOME/Workspace/go' >> ~/.profile
echo 'export PATH=$PATH:$GOPATH' >> ~/.profile
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >> ~/.profile
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.profile
echo 'export JAVA_HOME="$(/usr/libexec/java_home -v 1.8)"' >> ~/.profile
echo 'eval "$(rbenv init -)"' >> ~/.profile
echo "[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion" >> ~/.bash_profile
# Source our profile files
source ~/.profile
source ~/.bash_profile
# Install Ruby
ruby_version="2.6.1"
RUBY_CONFIGURE_OPTS=--with-readline-dir="$(brew --prefix readline)" rbenv install ${ruby_version}
rbenv local ${ruby_version}
rbenv global ${ruby_version}
# Source our profile files
source ~/.profile
source ~/.bash_profile
# Update Gems
gem update --system
# Some useful gems
gem_installs=(\
'nokogiri' \
'gist' \
'rails\ --pre' \
'rails' \
'cf-uaac'
}
eval \${cf_plugins[@]}
IFS=$'\n'
for gem in ${gem_installs[@]}; do
gem install $gem
done
unset IFS
# Rehash rbenv
rbenv rehash
# Configure zsh as our default shell
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
sudo dscl . -create /Users/$USER UserShell /usr/local/bin/zsh
# Update zsh config
zsh_plugins=(\
git \
colored-man \
colorize \
pip \
python \
brew \
osx \
zsh-syntax-highlighting \
ruby \
cloudfoundry \
docker \
grails \
gradle \
jsontools \
kubectl \
git-flow \
npm \
pyenv \
tmux \
vagrant \
)
sed -i .plugins "s/^plugins=([^)]*)/plugins=(${zsh_plugins[*]})/g" ~/.zshrc
#sed -i .theme '/ZSH_THEME/s/".*"/"agnoster"/' ~/.zshrc
sed -i .theme '/ZSH_THEME/s/".*"/"powerlevel9k\/powerlevel9k"/' ~/.zshrc
echo -e "\n# PowerLevel9K Setup\nPOWERLEVEL9K_MODE='nerdfont-complete'" >> ~/.zshrc
echo "source ~/.oh-my-zsh/themes/powerlevel9k/powerlevel9k.zsh-theme" >> ~/.zshrc
echo -e "\n# Source in .profile\nsource ~/.profile" >> ~/.zshrc
# Clone the Powerlevel9 Theme
git clone https://github.com/bhilburn/powerlevel9k.git ~/.oh-my-zsh/themes/powerlevel9k
# Download Solarized Dark Theme
curl -o ~/.oh-my-zsh/custom/SolarizedDark.terminal https://raw.githubusercontent.com/tomislav/osx-terminal.app-colors-solarized/master/Solarized%20Dark.terminal
curl -o ~/.oh-my-zsh/custom/SolarizedDark.itermcolors https://raw.githubusercontent.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors
curl -o ~/.oh-my-zsh/custom/material-design-colors.itermcolors https://raw.githubusercontent.com/MartinSeeler/iterm2-material-design/master/material-design-colors.itermcolors
# Download Powerline Fonts
git clone https://github.com/powerline/fonts.git --depth=1 ~/Downloads/fonts
cd ~/Downloads/fonts
./install.sh
rm -rf ~/Downloads/fonts
# Global Gitignore file
curl https://raw.githubusercontent.com/github/gitignore/master/Global/macOS.gitignore -o ~/.gitignore
# The Ultimate vimrc
git clone https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
# Maximum Awesome for Vim
git clone https://github.com/square/maximum-awesome.git ~/Downloads/maximum-awesome
cd ~/Downloads/maximum-awesome
rake
rm -rf ~/Downloads/maximum-awesome
# Sort out brew
brew doctor
brew update
brew upgrade
# Install CF Plugins
cf_plugins=(\
'log-stream' \
'report-memory-usage' \
'report-disk-usage' \
'log-cache' \
'app-autoscaler-plugin' \
'autopilot' \
'cfdev' \
'bg-restage' \
'cf-recycle-plugin' \
'drains' \
'blue-green-deploy' \
'report-buildpacks' \
'report-users' \
'log-noise' \
'app-metrics' \
'service-use' \
'top' \
'Service Instance Logging' \
'autopilot' \
'Firehose Plugin' \
'Targets' \
'open' \
'buildpack-usage' \
'do-all' \
'get-events' \
'route-lookup' \
'doctor' \
'Usage Report' \
'Buildpack Management' \
'Statistics' \
'wildcard_plugin' \
)
eval \${cf_plugins[@]}
IFS=$'\n'
for plugin in ${cf_plugins[@]}; do
echo "installing $plugin"
cf install-plugin -r CF-Community $plugin -f
done
unset IFS
# Install stuff from the app store using mas
mas_id_installs=(\
'497799835' \ # Xcode ID
'1116599239' \ # NordVPN IKE ID
'1295203466' \ # Microsoft Remote Desktop ID
'405580712' \ # StuffIt Expander ID
'675649574' \ # NetAdmin Pro ID
'1333542190' \ # 1Password 7 ID
)
eval \${mas_id_installs[@]}
IFS=$'\n'
for mas in ${mas_id_installs[@]}; do
echo "installing $mas"
mas install $mas
done
unset IFS
# Install cf-mgmt
echo "installing cf-mgmt"
mkdir -p $(go env GOPATH)/src/github.com/pivotalservices
cd $(go env GOPATH)/src/github.com/pivotalservices
git clone [email protected]:pivotalservices/cf-mgmt.git
cd cf-mgmt
glide install
go build -o cf-mgmt cmd/cf-mgmt/main.go
go build -o cf-mgmt-config cmd/cf-mgmt-config/main.go
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment