Skip to content

Instantly share code, notes, and snippets.

@riethmayer
Created April 6, 2014 10:57
Show Gist options
  • Save riethmayer/10004470 to your computer and use it in GitHub Desktop.
Save riethmayer/10004470 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Usage: bb devenv setup
# Summary: installs homebrew and all dependencies to run bonsubox projects
set -e
function abort {
echo "$1"
exit 1
}
function script_exists() {
command -v "$1" >/dev/null 2>&1
}
function require_xcode() {
[ -d $(xcode-select --print-path) ] || abort 'Xcode CLI is required. Type gcc to invoke.'
}
function install_homebrew() {
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
}
function require_package_manager() {
script_exists brew || install_homebrew
}
function package_install() {
brew install "$1"
}
function install() {
package_install "$1"
}
function install_postgres() {
if [ ! -d /usr/local/opt/postgresql ]; then
LC_ALL="en_US.UTF-8" LANG="en_US.UTF-8" install postgresql
ln -sfv /usr/local/opt/postgresql/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
echo "username is $USER and password is blank for postgres"
else
echo "postgres is already installed"
fi
}
function install_redis() {
if [ ! -d /usr/local/opt/redis ]; then
install redis
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
else
echo "redis is already installed"
fi
}
function install_rabbitmq() {
if [ ! -d /usr/local/opt/rabbitmq ]; then
install rabbitmq
ln -sfv /usr/local/opt/rabbitmq/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
else
echo "rabbitmq is already installed"
fi
}
function install_couchdb() {
if [ ! -d /usr/local/opt/couchdb ]; then
install couchdb
ln -sfv /usr/local/opt/couchdb/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.couchdb.plist
else
echo "couchdb is already installed"
fi
}
function require_python() {
[ -d /usr/local/share/python ] || install python
}
function install_awscli() {
require_python
pip install awscli
}
function install_rvm() {
if [ ! -d $HOME/.rvm ]; then
\curl -sSL https://get.rvm.io | bash
else
echo "rvm seems to be installed already"
fi
}
function install_coreutils() {
# used to support ubuntu-style ls commands
# e.g. like ls -X or ls --dired (for emacs :D)
if [ ! -f /usr/local/bin/ls ]; then
install coreutils
ln -s /usr/local/bin/gls /usr/local/bin/ls
fi
}
function install_elasticsearch() {
if [ ! -x /usr/local/bin/elasticsearch ]; then
brew install elasticsearch
ln -sfv /usr/local/opt/elasticsearch/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.elasticsearch.plist
else
echo "elasticsearch seems to be installed already"
fi
}
require_xcode
require_package_manager
install apple-gcc42
install_coreutils
install git
install go
install nodejs
install openssl
install phantomjs
install pkgconfig
install ruby
install tmux
install wget
install_postgres
install_redis
install_rabbitmq
install_awscli
install qt
install chromedriver
install selenium-server-standalone
install jq
install_couchdb
install_rvm
install_elasticsearch
install ack
brew linkapps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment