Running nwdiag on Mac OS X

nwdiag is a tool written in python for generating network diagrams from text files, rack diagrams can also be built using the bundled rackdiag utility.
nwdiag requires PIL built with freetype2 support, if this is missing you’ll receive the following error when you try to generate a diagram:
ERROR: The _imagingft C module is not installed.

Following the instructions in the README file included with PIL, once the build process completes you’ll receive a summary:
version 1.1.7
platform darwin 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]
--- TKINTER support available
*** JPEG support not available
--- ZLIB (PNG/ZIP) support available
*** FREETYPE2 support not available
*** LITTLECMS support not available

It appears that freetype2 support is not built by default & I wasn’t paying enough attention so I missed the notice following the summary
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the script.
After a brief search I came across this blog post which covered how to define the paths for the freetype library & header files.
Setting FREETYPE_ROOT in to
FREETYPE_ROOT = "/usr/X11/lib", "/usr/X11/include"
solved the problem & the summary listed --- FREETYPE2 support available when I reran the build process.
After that everything worked fine, the following config generated the image at the bottom of the page:
nwdiag {
inet [shape = cloud];
inet -- router;
network office {
"Mail server";
"Web server";

Network diagram generated using nwdiag

The project is still in its infancy and there are features missing for implementing common elements from a cisco discipline (like representing etherchannel) but it’s promising as you can put a simple diagram together very quickly.