As I’ve mentioned many times, I’m a huge fan of GraphViz software suite in general, and the dot tool in particular. It’s super handy for generating graphs and diagrams out of plain text files.
Today though I came across a problem that I haven’t seen before. While trying to generate an updated PNG graph from a dot file that used to work just fine before, I got the following:
$ dot -Tpng source.dot -o destination.png
Format: "png" not recognized. Use one of: canon cmap cmapx cmapx_np dot dot_json eps fig gv imap imap_np ismap json json0 mp pic plain plain-ext pov ps ps2 svg svgz tk vdx vml vmlz xdot xdot1.2 xdot1.4 xdot_json
That looks weird. I tried the same with a few other formats and none of them were working. A quick Google search around found the solution over at StackOverflow. All I had to do was:
$ sudo dot -c
After that, dot started working as always.