Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
128 lines (96 sloc) 4.3 KB
#!/usr/bin/env bash
# Check if git is installed
git --version 2>&1 >/dev/null
if [ $? -ne 0 ]; then
echo "Git is not installed, please install it before running this script"
exit 1
echo "Starting installation..."
# the current user must be the owner of /usr/local/*
sudo chown -R `id -nu` /usr/local/
# First check for dependencies
echo "[Dependency] Command Line Tools"
[[ -f /usr/bin/cc ]] || (echo "You need to download and install Command Line Tools. Look for ctools_lion_*.dmg"; exit)
# Oh-my-zsh
echo "Installing Oh-my-zsh, to enhance your shell ..."
if [ ! -d ~/.oh-my-zsh ]; then
curl -L | sh
echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install !"
# Setup SSH
echo "Checking for SSH key, generating one if it doesn't exist ..."
[[ -f ~/.ssh/ ]] || ssh-keygen -t rsa
echo "Copying public key to clipboard. Paste it into your Github account ..."
[[ -f ~/.ssh/ ]] && cat ~/.ssh/ | pbcopy
# Install Stuff
echo "Installing Homebrew, a good OS X package manager ..."
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL"
brew update
#echo "Put Homebrew location earlier in PATH ..."
#Homebrew path is in .zshenv
source ~/.zshrc
source ~/.zshenv
mkdir -p ~/Library/LaunchAgents # Will put startup scripts here
echo "Installing Redis, a good key-value database ..."
brew install redis
echo "Configuring Redis so that it starts at startup ..."
[[ -f ~/.ssh/ ]] || launchctl unload -w REDIS_CURRENT_PLIST
REDIS_PLIST=`ls /usr/local/Cellar/redis/*/homebrew.mxcl.redis.plist | tail -1`
echo "Copying $REDIS_PLIST to ~/Library/LaunchAgents/"
cp $REDIS_PLIST ~/Library/LaunchAgents/
launchctl load -w $REDIS_CURRENT_PLIST
echo "Installing MongoDB, a good NoSQL database ..."
brew install mongodb
echo "Configuring MongoDB so that it starts at startup ..."
[[ -f ~/.ssh/ ]] || launchctl unload -w $MONGO_CURRENT_PLIST
MONGO_PLIST=`ls /usr/local/Cellar/mongodb/*/homebrew.mxcl.mongodb.plist | tail -1`
MONGO_CONFIG=`ls /usr/local/Cellar/mongodb/*/mongod.conf | tail -1`
echo "Copying $MONGO_PLIST to ~/Library/LaunchAgents/"
echo "Copying $MONGO_CONFIG to /usr/local/etc/"
cp $MONGO_PLIST ~/Library/LaunchAgents/
if [[ ! -d /data/db ]]; then
echo "Need your password to sudo to create the folder /data/db";
sudo mkdir -p /data/db;
sudo chown `id -u` /data/db
cp $MONGO_CONFIG /usr/local/etc/mongod.conf
launchctl load -w $MONGO_CURRENT_PLIST
echo "Installing NodeJS ..."
curl | sh
echo "Installing ack, a good way to search through files ..."
brew install ack
echo "Install ssh-copy-id, because you just want to type your password once..."
brew install ssh-copy-id
echo "Installing tmux, a good way to save project state and switch between projects ..."
brew install tmux
echo "Installing image, good for cropping and re-sizing images ..."
brew install imagemagick --disable-openmp --with-magick-plus-plus
echo "Installing automake, which is need for doing rvm install --with-gcc=clang"
brew install automake
echo "Installing RVM (Ruby Version Manager) ..."
curl -L | bash -s stable --ruby
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
bash < <(curl -s
#empties the .zprofile (avoid conflicts for RVM)
echo '' > ~/.zprofile
echo "Adding useful aliases and Applidget's configuration ..."
echo "
# Auto CD
setopt auto_cd
cdpath=(~ ~/code/ror ~/code/ios ~/code/node ~/code/cpp)
" >> ~/.zshrc
# source ~/.zshrc
# Setting up Applidget defaults code directories
echo "Setting up ~/code directory. That's where you gonna work buddy ..."
mkdir -p ~/code/ror/watched
mkdir -p ~/code/node/watched
mkdir -p ~/code/ios/watched
# Textmate files
# now included with other dotfiles
echo "Please source your .zshrc in a oh-my-zsh terminal after installation"
echo "Now fork the dotfiles repo (, and follow instructions (customizing .zshenv, ...)"