The latest MacOS versions already include Spanish dictionaries which can be enabled in preferences in the Dictionary.app (⌘+,).
The answer below is for converting and installing third-party dictionaries from other popular formats.
To create a dictionary for the built-in OS X Dictionary.app you will first need pyglossary (pip3 install pyglossary
) to convert to AppleDict format from the input format such as ABBYY Lingvo DSL, Babylon BGL, Stardict IFO, AARD Slob etc (see supported formats).
Once you generate the AppleDict source XML, you'll need the Apple Dictionary Development Kit to create the native binary files for the Dictionary.app.
Proceed as follows:
Installing dependencies
- Install Xcode command line tools:
xcode-select --install
- Install the Additional Tools for Xcode from https://developer.apple.com/download/ (search with 🔎 )— 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, use this if you want compatibility with
Makefile
's generated by pyglossary) (or to ~/Developer/Extras
as a regular user as pointed out by richard-möhn — ❗️ in this case you'll need to manually edit the Makefile
to point to the correct location of the Dictionary Development Kit
folder):
mkdir -p ~/Developer/Extras
cp -r '/Volumes/Additional Tools/Utilities' ~/Developer/Extras
- Install Python 3 via homebrew (OS X comes with Python 2.x preinstalled):
brew install python3
- Install pyglossary and dependencies:
pip3 install -U lxml beautifulsoup4 html5lib PyICU prompt_toolkit python-lzo
Performing the Conversion
- Convert the source dictionary (in the example below, Babylon BGL) to AppleDict Source:
pyglossary --read-options=resPath=OtherResources --write-format=AppleDict webster.bgl webster.xml
- Compile the generated AppleDict sources to OS X 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 the 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 && make install
NOTE: 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 ~/Library/Dictionaries
.
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. Here is a wrapper script for DSL to AppleDict conversion.
There are also literally hundreds of dictionaries available in DICTD, Stardict and ABBYY Lingvo DSL formats.
See also: