Improved godoc Launch Agent for OS X

I recently found instructions from Dave Cheney on installing godoc as a launch agent in OS X. It’s really cool to have Go’s documentation running locally and to have the system ensure it’s always running for you, but I realized you can get it to display your own packages as well.

It’s insanely helpful to have documentation auto-generated for my packages that are consistent with and as nice as the documentation for the standard library.

This requires only a slight tweak in Dave’s file, adding your GOPATH as an environment variable (toward the bottom):

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
      <!-- ensure this is the absolute path to your godoc install -->
     <!-- ensure this is your absolute gopath -->

Simply install that to ~/Library/LaunchAgents/org.golang.godoc.plist, and run:

launchctl load ~/Library/LaunchAgents/org.golang.godoc.plist

Now navigate to [][1] and see all of your own code alongside the standard library.


If you want to enable search, it’s just a small tweak to that file. Add this line just below the http flag:


(You can also play with adding the index_throttle flag if you want that to use less cpu or finish quicker.)

I have found that once the index is created, it never gets updated. So to refresh the search index, kill the godoc process (launchd will restart it).