To create a dictionary for the built-in OSX Dictionary.app you will first need pyglossary to convert to the AppleDict format from the input format which can be ABBYY Lingvo DSL, Babylon BGL, Stardict IFO, etc (see all supported formats).
Once the AppleDict source XML is generated, the Apple Dictionary Development Kit is used to generate the native binary files that the Dictionary.app can use.
Proceed as follows:
- Install Xcode command line tools:
- Install the Auxiliary Tools for Xcode 7 from https://developer.apple.com/download/more/ — you'll need to login with your iCloud or Apple Developer account. Mount the DMG file by double-clicking it in Finder, and copy the folder Dictionary Development Kit to /Developer/Extras (as root):
sudo mkdir -p /Developer/Extras/
sudo cp -r '/Volumes/Auxiliary Tools/Dictionary Development Kit' /Developer/Extras
- Install Python 3 via homebrew (OSX comes with Python 2.x preinstalled):
brew install python3
- Checkout the pyglossary project:
mkdir -p ~/projects
git clone --depth 1 https://github.com/ilius/pyglossary.git ~/projects/pyglossary
- Install lxml and BeautifulSoup, the parsers that pyglossary depends on:
(for current user only)
pip3 install lxml beautifulsoup4 --user
sudo pip3 install lxml beautifulsoup4
Now everything is ready to do the actual conversion.
Performing the Conversion
- Convert the source dictionary (in this case Babylon BGL) to AppleDict:
python3 pyglossary.pyw --read-options=resPath=OtherResources --write-format=AppleDict webster.bgl webster.xml
NOTE: This operation can take significant time if the dictionary is big.
- Compile the generated AppleDict sources to OSX Dictionary.app binary files. Pyglossary creates the AppleDict sources in a subfolder named the same as the source file.
OPTIONAL: By default the dictionary name will be derived from the file name of the input file. If you want to modify the name to something else then open
Makefile in a text editor, and set the title in the DICT_NAME variable (make sure you include the quotes).
cd webster ### subdir name is derived from the source file
make can take significant time if the dictionary is big. For huge dictionaries it can take over 10 minutes.
make install copies the generated dictionary to
Now if you restart the dictionary app and and open preferences (⌘+,) the new dictionary will appear in the list. Click the checkbox to enable it.
Other formats, for example ABBYY Lingvo DSL require more steps such as re-encoding from UTF-16 to UTF-8. Here is a wrapper script for DSL to AppleDict conversion.
And finally, the latest OSX versions already include Spanish dictionaries which can be enabled in preferences in the Dictionary.app (⌘+,).
Here are some Free dictionaries in Babylon BGL format. There are also literally hundreds of dictionaries available in DICTD, Stardict and ABBYY Lingvo DSL formats.