Skip to content
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
fi
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 https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
else
echo "You already have Oh My Zsh installed. You'll need to remove ~/.oh-my-zsh if you want to install !"
fi
# Setup SSH
echo "Checking for SSH key, generating one if it doesn't exist ..."
[[ -f ~/.ssh/id_rsa.pub ]] || ssh-keygen -t rsa
echo "Copying public key to clipboard. Paste it into your Github account ..."
[[ -f ~/.ssh/id_rsa.pub ]] && cat ~/.ssh/id_rsa.pub | pbcopy
open https://github.com/settings/ssh
# Install Stuff
echo "Installing Homebrew, a good OS X package manager ..."
/usr/bin/ruby -e "$(/usr/bin/curl -fksSL https://raw.github.com/mxcl/homebrew/go)"
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 ..."
REDIS_CURRENT_PLIST=~/Library/LaunchAgents/homebrew.mxcl.redis.plist
[[ -f ~/.ssh/id_rsa.pub ]] || 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 ..."
MONGO_CURRENT_PLIST=~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
[[ -f ~/.ssh/id_rsa.pub ]] || 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
fi
cp $MONGO_CONFIG /usr/local/etc/mongod.conf
launchctl load -w $MONGO_CURRENT_PLIST
echo "Installing NodeJS ..."
curl http://npmjs.org/install.sh | 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 https://get.rvm.io | bash -s stable --ruby
# RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
bash < <(curl -s https://raw.github.com/applidget/laptop/master/ruby)
#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 (https://github.com/ssaunier/dotfiles), and follow instructions (customizing .zshenv, ...)"
Something went wrong with that request. Please try again.