Step 0: Get Homebrew installed on your mac if you don't already have it Step 1: Install highlight. "brew install highlight". (This brings down Lua and Boost as well) Step 2:
OS X Screencast to animated GIF This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle. Instructions To capture the video (filesize: 19MB), using the free "QuickTime Player" application: