Re-setting / Re-Indexing Apple OSX Help Books

While developing applications and the associated help books, sometimes you need to flush the cache to test updates to your applications Apple Help Book.

I won’s say this is the most effective, or correct way to handle the issue, I will say it’s the one that worked for me.

First order of business is to flush out the help cache. NOTE: If you do this, you’ll need to make sure and restart helpd to create the fresh cache entries.

You will find your user’s cached versions of the files located here:


~/Library/Caches/com.apple.helpd

Located there are the following 3 items (two files and one directory)


-rw-r--r-- 1 mememe staff 6574080 Feb 7 22:13 Cache.db
drwxr-xr-x 56 mememe staff 1904 Feb 2 13:37 Generated
-rw-r--r-- 1 mememe staff 69585 Feb 7 22:15 HelpCache.plist

The application I’m looking to flush the help file for is com.daviddemartini.cidrcalculator.help. It’s highlighted in this partial list here:


[...]
com.apple.Mail.help
com.apple.keychainaccess.help
com.apple.PhotoBooth.help
com.apple.machelp
com.apple.PodcastCapture.help
com.canon.Digital Photo Professional.help
com.apple.PodcastPublisher.help com.daviddemartini.cidrcalculator.help
com.apple.Preview.help
com.apple.QuickTimePlayerX.help com.prect.NavicatPremium.help
[...]

I removed that directory and it’s contents, then removed the two cache files in the upper most directory (first one we entered):


cd com.daviddemartini.cidrcalculator.help
rm English.helpindex
cd ..
rmdir com.daviddemartini.cidrcalculator.help
cd ../..
rm Cache.db HelpCache.plist

Next I went looking for copies of the help plist files to wipe them out:


find ~/Library/Caches -name 'com.apple.help.plist'

./Containers/com.apple.Preview/Data/Library/Preferences/com.apple.help.plist
./Containers/com.apple.TextEdit/Data/Library/Preferences/com.apple.help.plist
./Preferences/com.apple.help.plist

Based on some vague recollection of the last time I did this, and one Google page the skirted around it (not really calling out this very file) I nuked the preferences help.plist.


rm ./Preferences/com.apple.help.plist

Then I went looking for the start-up process for helpd, and eventually located it by looking in this file:


cd /System/Library/LaunchAgents

cat com.apple.helpd.plist



[...]
Program
/System/Library/PrivateFrameworks/HelpData.framework/Versions/A/Resources/helpd
EnableTransactions
[...]

Here is where it’s at:

/System/Library/PrivateFrameworks/HelpData.framework/Versions/A/Resources/helpd

Since the reason I was doing this was to update my Help Book, I want to be sure I’ve re-indexed it. There are at least two primary ways to do it. The GUI App (/Developer/Applications/Utilities/Help Indexer.app) or the command line tool (hiutil).

I’m going for the command line version. The following commands create a new index file right in my help directory.


hiutil -Caf CidrCalc.help/CidrCalcHelp.helpindex CidrCalc.help

Finally, executing the helpd compiler to make the book available:


root# /System/Library/PrivateFrameworks/HelpData.framework/Versions/A/Resources/helpd &

So, there are some crude, ugly but hopefully effective for you, Apple Help Book Reset and Rebuilding Steps.