Update: This post is old and outdated. I’ll have another post in 2015 about workstation management with Chef.
It has been a few months and several thousand page views since my original post on how I manage my workstations with Chef. I have made some changes to my repository, and have a few additional notes for working with Mac OS X Lion. I also added a new system in my network, an iMac.
Mac OS X Cookbook
First, I would like to point out the cookbook I created, mac_os_x. In the original post, I discussed using Pivotal Lab’s workstation recipes, which use the Mac OS X user defaults system to update system preferences from the command-line (with an execute resource). One of the first things I did in the mac_os_x cookbook is create a lightweight resource and provider for managing user defaults. It can be used, for example, like this:
mac_os_x_userdefaults "dont show hard drives on the desktop" do domain "com.apple.finder" key "ShowHardDrivesOnDesktop" value "false" type "bool" end
While this does involve more typing than just entering the command, it has a couple advantages. First, it is easier to read for people not totally familiar with the defaults command. Second, behind the scenes it will check if the setting is already set and not update the resource if it isn’t. This isn’t a huge deal in terms of system resource usage, but depending on your Chef setup might end up with extra reporting on things that didn’t need to change if you’re using a report handler, which I do use.
This cookbook also includes a lightweight resource/provider for managing plist preferences files for
~/Library/Preferences. All plists in OS X can be manipulated through the defaults system, but it can be cumbersome for highly customized applications such as your Adium or 1Password configuration. Usage is very simple:
This is in my local 1password cookbook, which has the file in
files/default/ws.agile.1Password.plist. If I make modifications to the preferences, I do have to copy it over to the cookbook and re-upload to the Chef Server, but since I now have 4 computers to change preferences on, this is much easier than remembering everywhere I clicked. I use this for managing my preferences for ghmac (GitHub for Mac), iterm2 and alfredapp.
Mac OS X Lion
Lion brought a lot of changes. In particular along with Xcode 4, Apple changed the gcc compiler to llvm. I’m not a C programmer, and don’t really understand the differences yet, I just know that a number of things in Homebrew fail to build. The main thing I installed with Homebrew that wasn’t working with Lion is Emacs. I actually only have Lion on my iMac, so I haven’t updated any recipes for installing it via Chef. In fact, I actually removed it from my “workstation” recipe and *gasp* installed it manually. The story there is enough for another post though, so stay tuned and I’ll write up my experience.
Relevant to how I manage workstations with Chef, I had to make sure that on Lion, I take care of some additional new preferences using my handy-dandy “mac_os_x_userdefaults” LWRP. These are in the mac_os_x cookbook recipe, “lion_tweaks.” In my workstation recipe, I include this one only on Lion.
If you haven’t read it yet, go back and read my post on how I manage my workstations with Chef. I hope if you’re using Chef to manage a Mac that the mac_os_x cookbook is useful to you. Also, stay tuned for an update later this week about my experiences installing Emacs on Lion.