On a rather obscure comment thread, someone explained where you might find the word list that Apple uses to power the screensaver. It is at /System/Library/Graphics/Quartz\ Composer\ Plug-Ins/WOTD.plugin/Contents/Resources/NOAD_wotd_list.txt
. The file looks like this:
m_en_us1282510 quinsy
m_en_us1273791 orbicular
m_en_us1220945 alimony
m_en_us1250517 genome
It is a list of tab-separated entries. On the right you have the word, and on the left, what looks like an ID. But what's it an ID for, and how would you be able to find it for another word not already on the list?
As you might expect, the ID refers to an entry in Apple's default dictionary, the "New Oxford American Dictionary". (That's what "NOAD" stands for in the word-list path above.)
How to find the IDs for other words?
A fellow named Joseph Gentle, in a series of blog posts, shows how to get at the data underlying Apple's dictionaries. In his "Apple dictionaries, part 2" post, he points to code that unpacks the relevant binary file (stored in /Library/Dictionaries
) into XML. Using the dedict.c
and strip.c
files found here, and following Gentle's example, I used the following bash commands to get at the NOAD's XML (these commands are run from the directory where you downloaded the dedict.c
and strip.c
files):
clang dedict.c -Wall -lz -o dedict
clang strip.c -Wall -lz -o strip
./dedict "New Oxford American Dictionary" | ./strip > dict.xml
When I head
-ed the first few lines of the dict.xml
file, I saw something promising, with entries that looked like this:
<d:entry xmlns:d="http://www.apple.com/DTDs/DictionaryService-1.0.rng" id="m_en_us1219333" d:title="abode" class="entry">
Notice that id
param... it's an identifier that looks exactly like the one in the screensaver word list!
I wrote the following Ruby script to parse the XML, and then, using my own word list, create a new screensaver file that maps my own words to their IDs in the dictionary:
raw = File.open("./dict.xml").read
my_words = File.open("./word_list.csv").readlines.map { |line| line.split(',')[1] }
word_id_map = {}
raw.scan(/<d:entry .*? id="(.*?)" d:title="(.*?)" class="entry">/).each do |entry|
word_id_map[entry[1]] = entry[0]
end
my_words.each do |word|
if id = word_id_map[word]
puts [id, word].join(' ')
end
end
When I replaced the original screensaver file with this new one, it worked. You can now have a "Word of the Day" screensaver that gives definitions for the words you choose.
The spelling dictionaries you are interested in appear to be located in the following location (checked on 10.8.4 and 10.6.8):
/System/Library/Services/AppleSpell.service/Contents/Resources/
The word lists are stored in this directory by language, so U.S. English is in the English.lproj
folder.
However, these files are stored in a binary format that I haven't deciphered yet...
Best Answer
They are supposed to be added automatically as a part of post-upgrade updating process. The upgrade itself doesn't bring everything up to date, the apps that are not part of the OS and some nonessential components are updated later.
If you are stuck with the lack of dictionaries for a prolonged time (more than a day and a couple or so of restarts), and especially if you see the degraded overall performance of your Mac, most probably the updating process is broken. I had the same picture yesterday, so I've started investigating and solved it. Maybe you have the same bug that I have had, maybe not. Still, I hope my solution would help, and to make it more general, I will describe the process, too -- so that even if your source of trouble is different, you can find your own solution.
So, first I've opened the Activity Monitor to found that trustd and nsurlsessiond are eating up the CPU. I even had to kill trustd (nsurlsessiond went down after that, too) so that I could continue to work without lots of spinballs. It looked like trustd tries to verify some app, and calls nsurlsessiond for update information and/or update itself, which, in turn, fails.
Then I've opened the Console and started searching in logs for nsurlsessiond -- and found lots of records that __mkdir failed to create a directory, "not permitted". The directory in question was /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k/0 . I went to its parent /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k and I've found in the Get Info that while _nsurlsessiond as a user had Read and Write permission, as a group it had Read only permission. Now, /private/var/folders/zz/ is not a place to mess with, but adding a permission to a known daemon and creation of a new directory are not that dangerous, so I did both: changed the permission of group _nsurlsessiond for /private/var/folders/zz/zyxvpxvq6csfxvn_n00000y800007k to Read and Write (to do that you must first unlock it in the right-down corner of Get Info box), and created a new folder "0" in it, making sure it also gets Read and Write privilege for _nsurlsessiond.
Then I've restarted, and let the Mac idle for a while. Soon App Store showed updates for some apps that I didn't even remember. I let them all update, updated some other apps that could not auto-update previously (such as Chrome), and again let it idle or semi-idle while I was browsing the web etc. I intentionally avoided opening the Dictionary app at that time. Today I restarted the Mac again, opened the Dictionary app, and found that all its dictionary tabs are back; when I've clicked on the German tab, it said "wait a minute for a download" and almost immediately showed me the dictionary. All the other dictionaries were back, too, after that.