I learned a new word yesterday: chyron. I had use a search engine to find its definition, because dict(1) didn’t find it. (While writing this it occurs to me that maybe macOS’ Dictionary.app has it; it does.)

chyron in Dictionary.app

I try to use dict(1) because most of the dictionary sites I stumble across are riddled with ads and whatnot which make the experience quite suboptimal.

So can I run my own dictd(8) server and feed it my own definitions? I can, and do that here with a completely invented definition of a word in order to be able to see “my” word being used.

First I create a list of words. dictd supports many different types of lists, and the manual pages attempt to explain them. I begin with a format I easily understand and use the dictfmt utility to convert that to files which the server then reads.

$ cat mydict.txt
:usb:Unpossible Serial Business
:jane:You don't know Jane?!? Elle est très Jolie

$ cat Makefile
mydict.dict: mydict.txt
	dictfmt --utf8 --allchars -s "Mi diccionario" -j mydict < mydict.txt

After running make, I see two new files (mydict.{dict,index}). I then create a configuration file dictd.conf for the server, and launch it:

$ cat dictd.conf
database uno {
	data "/var/dict/mydict.dict"
	index "/var/dict/mydict.index"

$ /usr/local/sbin/dictd --config dictd.conf --verbose \
                        --logfile log.0  --pid-file /tmp/dict.pid \
                        -d nodetach 

My first test uses telnet(1) to connect to the server, but I could also use the protocol Swiss army knife: curl can query my dict server: curl dict://

$ telnet localhost 2628
Connected to localhost.
Escape character is '^]'.
220 jmbp.ww.mens.de dictd 1.12.1/rf on Darwin 19.3.0 <auth.mime> <3.88151.1583656134@jmbp.ww.mens.de>

show db
110 1 databases present
uno "Mi diccionario"
250 ok
221 bye [d/m/c = 0/0/0; 4.000r 0.000u 0.000s]
Connection closed by foreign host.

I then use the dict(1) client, and specify localhost as it likely defaults to using dict.org as a server:

$ dict -h localhost jane
1 definition found

From Mi diccionario [uno]:

  You don't know Jane?!? Elle est très Jolie

Now I configure dict(1) to use only my server. (As an aside, when installing from Homebrew I note there is a /usr/local/etc/dict.conf which contains localhost and dict.org which are queried in that order.)

$ echo 'server { port 2628 }' > ~/.dictrc

$ dict usb
1 definition found

From Mi diccionario [uno]:

  Unpossible Serial Business

In theory dict.org has a lot of background information and data on DICT (RFC 2229), but unfortunately the site doesn’t seem to get much love, and most of the links are dead; the FTP server at which they point has been unreachable for over a month, likely longer.

I thought I’d try installing WordNet®, which is made available by Princeton University, but I’ll admit that I got stuck at building the software because I didn’t feel like installing TCL/Tk so I took the easy route and extracted the required data files from the Debian dict-wn package:

$ mkdir t
$ dpkg-deb -R dict-wn_3.0-35_all.deb t
$ ls t/usr/share/dictd/

After changing my dictd.conf to add that dictionary, I query it, and dict(1) finds words I specify in all configured databases.

$ dict dinner chyron
2 definitions found

From Mi diccionario [uno]:

  I think we'll have sucuklu yumurta or Rindswürstchen, pink sauce, and
  potato salad with onions and capers

From WordNet (r) 3.0 (2006) [wn30]:

      n 1: the main meal of the day served in the evening or at
           midday; "dinner will be at 8"; "on Sundays they had a large
           dinner when they returned from church"
      2: a party of people assembled to have dinner together; "guests
         should never be late to a dinner party" [syn: {dinner},
         {dinner party}]
1 definition found

From Mi diccionario [uno]:

  a caption superimposed over usually the lower part of a video image (as
  during a news broadcast)

Speaking of Debian, they package a large number of dictionaries which are just an apt install away, and they’re also configured into dictd as soon as you install them. Well done.

If the dictd server which runs on dict.org is maintained as “well” as the Web site there, I see a bleak future for the Dict service; that would be a shame.


  • A comment on Hacker News amused me: “the protocol is so simple, netcat or any other TCP client works just as well”. Here I search for “computer”:
printf "DEFINE all computer\nQUIT" | nc -vv dict.org 2628 | col -bx
dict, words, and unix :: 08 Mar 2020 :: e-mail