The rest of this tutorial assumes that the following is installed with default settings:
- Virtual Box to provide a local virtual machine to manage using Chef,
- Vagrant to give a command line interface to manage it and,
- Git to revision our Chef code.
Download and run the git installer at http://git-scm.com, accepting the default options.
Open git bash and set the following commands:
$ git config --global user.name "<YOUR NAME HERE>" $ git config --global user.email "<YOUR EMAIL HERE>"
Ruby & Chef
Since Chef runs on Ruby, you'll need to install a valid Ruby runtime. There are two options:
If you're just looking to play with Chef, we recommend the omnibus installer. This will install Chef and Ruby on your system. However, if you already have Ruby installed, or if you would like finer control over your workstation, checkout the Advanced tab.
$ curl -L https://www.opscode.com/chef/install.sh | sudo bash
Finally, to reduce typing in the future, add Omnibus Ruby to your path:
$ echo 'export PATH="/opt/chef/embedded/bin:$PATH"' >> ~/.bash_profile && source ~/.bash_profile
Xcode is a free apple application - you wont be using it directly, but the build tools are necessary to compile Ruby on your system.
Install Xcode from the AppStore
Launch Xcode from the
Open Xcode Preferences
Click "Download" on "Command Line Tools"
Once the installation has finished, you can quit Xcode
Homebrew is "the missing package manager for OS X". We will use homebrew to install a Ruby version manager and a Ruby builder. You could also use homebrew to install Ruby for you, but that's not recommended at this time.
Installing homebrew is just a single command.
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
rbenv is a Ruby Version Manager - it allows you to have multiple versions of Ruby on your system and easily switch between them.
Install rbenv and ruby-build from homebrew. In Terminal:
$ brew install rbenv ruby-build
Add rbenv to your path:
$ echo 'eval "$(rbenv init -)"' >> ~/.bash_profile && source ~/.bash_profile
Install the target Ruby version:
$ rbenv rehash $ rbenv install 1.9.3-p385 $ rbenv shell 1.9.3-p385 $ rbenv global 1.9.3-p385
Now install Chef as a gem:
$ gem install chef $ rbenv rehash