Where should a command line tool store cache files in OS X?
It depends on the type of data being cached - is it per user or system wide? 

If per user, there's nothing wrong with using a dot-prefixed directory in the user's home directory (that's what it's for, after all, and very much the UNIX way) or perhaps /tmp/&lt;username&gt; if the data is not to be persisted. If it's system wide and meant to be persisted, check the hier manual page - /var/db/&lt;appname&gt; may be an option?

One other Mac OS-specific option is to use /var/folders (as documented in hier(7)). As mentioned, you can retrieve the user-specific temporary directory by calling getconf DARWIN_USER_CACHE_DIR.