Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

Local Development Setup for Chef

Install git

Linux: sudo yum install git Mac: Download Windows: Download

  • posh-git: A set of PowerShell scripts that provide Git/PowerShell integration
  • Download posh-git

Download and install


virtual box


Use these instructions to install the chefdk installation instructions

If you are not able to run chef-dk check out this blog post by Mischa Taylor:

Set Up a Sane Ruby Cookbook Authoring Environment for Chef on Mac OS X, Linux and Windows

Don't forget to set the embedded ruby shipped with Chef first in your PATH

echo 'export PATH="/opt/chefdk/embedded/bin:$PATH"' >> $HOME/.bash_profile

Make sure ruby is installed and working

which ruby && ruby -v

Install kitchen-vagrant gem if not already present

chef gem install kitchen-vagrant

Install Text Editor


  • atom plugins:
  • vim-mode
  • language-chef
  • linter
  • linter-foodcritic
  • linter-rubocop
  • remote-sync
  • linter-package-json-validator
  • colorful-json

sublime text

VisualStudio Code

Local cookbook development workflow

create new cookbook using the chef generate command

chef generate cookbook your-cookbook

list test-kitchen VM's

kitchen list

use Berkshelf to download dependency cookbooks

berks install if applicable

Modify .kitchen.yml to specify platforms, run-list, verifier,

  name: vagrant

  name: chef_zero

# Uncomment the following verifier to leverage Inspec instead of Busser (the
# default verifier)
# verifier:
#   name: inspec

  - name: ubuntu-14.04
  - name: centos-7.1

  - name: default
      - recipe[your-cookbook::default]

Modify .kitchen.yml to add cpu/memory and port forwarding if needed

  - ["forwarded_port", {guest: 8080, host: 8080}]
    memory: 2048
    cpus: 2

Show all kitchen instances

kitchen list

Run VM for CentOS 7.1 and converge with configuration

kitchen converge centos

see git status of files added and modified

git status

add all files

git add .

commit all changes

git commit -m "initial commit of cookbook"

link to Chef tutorials

Chef tutorials

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment