Last active
December 28, 2015 09:59
-
-
Save molowny/7483103 to your computer and use it in GitHub Desktop.
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 zsh | |
| # before: | |
| # xcode-select --install | |
| # chsh -s /bin/zsh | |
| # | |
| # and run: | |
| # zsh <(curl -s https://gist.github.com/olownia/7483103/raw/8fa43deefbb7cb2aa6308291ee6a825a4351abce/mac.bash) | |
| trap 'ret=$?; test $ret -ne 0 && printf "failed\n\n" >&2; exit $ret' EXIT | |
| set -e | |
| if [ ! -d "$HOME/.bin/" ]; then | |
| mkdir "$HOME/.bin" | |
| fi | |
| if [[ ":$PATH:" != *":$HOME/.bin:"* ]]; then | |
| echo 'export PATH="$HOME/.bin:$PATH"' >> ~/.zshrc | |
| source ~/.zshrc | |
| fi | |
| fancy_echo() { | |
| printf "\n%b\n" "$1" | |
| } | |
| if [[ -f /etc/zshenv ]]; then | |
| fancy_echo "Fixing OSX zsh environment bug ..." | |
| sudo mv /etc/{zshenv,zshrc} | |
| fi | |
| fancy_echo "Installing Homebrew, a good OS X package manager ..." | |
| ruby <(curl -fsS https://raw.github.com/mxcl/homebrew/go) | |
| brew update | |
| if ! grep -qs "recommended by brew doctor" ~/.zshrc; then | |
| fancy_echo "Put Homebrew location earlier in PATH ..." | |
| echo "\n# recommended by brew doctor" >> ~/.zshrc | |
| echo "export PATH='/usr/local/bin:$PATH'\n" >> ~/.zshrc | |
| source ~/.zshrc | |
| fi | |
| fancy_echo "Installing Postgres, a good open source relational database ..." | |
| brew install postgres | |
| initdb /usr/local/var/postgres -E utf8 | |
| ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents | |
| launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
| fancy_echo "Installing Redis, a good key-value database ..." | |
| brew install redis | |
| ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents | |
| launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist | |
| fancy_echo "Installing ImageMagick, to crop and resize images ..." | |
| brew install imagemagick | |
| fancy_echo "Installing rbenv, to change Ruby versions ..." | |
| curl -L https://get.rvm.io | bash -s stable | |
| if ! grep -qs "rvm" ~/.zshrc; then | |
| echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"' >> ~/.zshrc | |
| fi | |
| source ~/.zshrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment