Accessing OS X dictionary with Python
Here's a little script that allows you to access the OS X Dictionary app using Python.
The OS X Dictionary app is a powerful built-in tool that provides access to multiple dictionaries, thesauruses, and reference materials. However, accessing it programmatically from the command line can be challenging. This Python script bridges that gap by providing a simple interface to query the Dictionary app directly from your terminal.
The script uses Python's subprocess module to call the built-in open dict:// URL scheme, which triggers the Dictionary app to look up a specific word. This is particularly useful for developers and writers who prefer to stay in the terminal while working and need quick access to word definitions, synonyms, and other reference information.
Practical tip: Make the script executable (chmod +x script_name.py) and add an alias for it in your .bashrc or .zshrc file (e.g., alias dict='python /path/to/script.py') to be able to call it from the command line easily. This way, you can simply type dict word to instantly look up any term.