Recently I joined a team that practices DevOps. That's why I had to learn Chef:

With Chef, you write abstract definitions as source code to describe how you want each part of your infrastructure to be built, and then apply those descriptions to individual servers.

Since I regard my iMac as part of my infrastructure - I decided to give Chef a shot. In this post I explain how I did it.

Bootstrapping chef

Before the first Chef run, you have to prepare youre machine.

I store my cookbooks on Dropbox. So after installing the OS (manually), I download and install Dropbox.

After Dropbox finished syncing I run :


mkdir ~/tmp  
cd ~/tmp

# Install GCC + Git

curl > GCC-10.7-v2.pkg  
    sudo installer -pkg GCC-10.7-v2.pkg -target /

# Install chef

sudo gem install chef

# Prepare Directory for Homebrew

sudo mkdir /usr/local  
sudo chown -R $USERNAME /usr/local  

This installs a compiler, Homebrew and some dev-tools like GIT on the machine.

Last but not least installs Chef itself.

Installing apps & packages

I have my standard set of tools. Instead of installing them manually I wanted to use Chef.

Luckily there are already cookbooks that can install dmg's and apps within zip files.

You just have to download them and then you can specify which apps to

dmg_package "Google Chrome" do  
  dmg_name "googlechrome"
  source ""
  action :install

zip_app_package "Mou" do  
  source ""

dmg_package "Virtualbox" do  
  source ""
  type "mpkg"

For all my Unix tools I use the Homebrew cookbook.

This way I can specify all the packages I need in my node.json - the configuration file I use to run chef-solo.

  "run_list": [

  "packages" : [

  "homedir" : "/Users/shostakovich",
  "user" : "shostakovich"


I store most of my dotfiles on my Dropbox.

When i set up a new machine i symlink them into my home directory. Last but not least, i change some defaults - for example to move the Dock out of the way..

template "#{node['homedir']}/.vimrc" do  
  source "vimrc.erb"
  owner node['user']

execute "set dock to be on left" do  
  command "defaults write orientation -string left"
  user node['user']

execute "relaunch dock" do  
  command "killall Dock"


How can you get started?

I highly recommend giving it a shot! It's a good way to learn chef.

For a kick start with chef-solo, watch RailsCast 339.

If you have problems setting up chef-solo on a Mac, have a look at how to fix solo.rb.

If you need further ideas, have a look at the workstation setup of pivotal.

The end

I used this a couple of times already. Its kind of boring, to watch chef setting up your dev-machine. But hey - you can drink coffee in the meantime.