Lily Chen — Local Development Setup for OS X Yosemite

Lily is a Product Designer based in San Francisco.
Currently, AngelList. Previously, IBM.

↑ Back

Local Development Setup for OS X Yosemite

I purchased a new Macbook and found myself in the very tasking process of setting everything back the way it used to be so I’ve decided to document what I do for a general setup.

Hidden Files

First let’s reveal all the hidden files to make things easier to find. In Terminal, enter sudo nano ~/.bash_profile. Then, paste these two lines into the file:

alias showFiles='defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app'
alias hideFiles='defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app'

Then save the file with Ctrl + O and then Ctrl + X to return to the command line. You can now run showFiles to see hidden directories and hideFiles to hide them.

Installations

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew cask install google-chrome iterm2 alfred sublime-text spectacle caffeine java spotify unrarx

Sublime Text

PostgreSQL

I use PostgreSQL for both my rails and django projects so I won’t be installing MySQL on my computer just yet. To get PostgreSQL, I run

brew install postgresql

# Start postgresql at login
ln -sfv /usr/local/opt/postgresql/*plist ~/Library/LaunchAgents

# Load postgresql now
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Ruby on Rails

OS X comes with ruby installed but let’s get our own by first running brew install rbenv ruby-build. You may need to add if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi to your .bash_profile to be able to access the command directly. Then install ruby and rails with

rbenv install 2.2.3
rbenv global 2.2.3
gem install rails
rbenv rehash

Django

To avoid conflicts between packages for each project, let’s install Django to work with virtual environments. To do so, run

brew install python
pip install virtualenv virtualenvwrapper
mkdir ~/.virtualenvs

Then, yet again edit your .bash_profile file and add the following to get a shortcut to activate/deactivate your virtual environments.

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
export PIP_VIRTUALENV_BASE=$WORKON_HOME
alias workoff='deactivate'

Now, you should be able to run mkvirtualenv test to create a new python virtual environment named “test” and use workon test to activate it. Once you’re in the proper virtualenv, run pip install django psycopg2 to get Django and have it to be able to interact with PostgreSQL.

Extra Steps

Summary

Although this article was fairly long, it really only takes at most an hour to finish. I definitely have multiple Terminal sessions going at once when they don’t have any dependency conflicts. I have also had a lot of trouble configuring Apache manually so I kind of cop out by using MAMP but I’ll keep working out the kinks before I post any instructions.