macOSの「辞書」アプリで自分専用辞書を使用する方法

[PR]記事内のアフィリエイトリンクから収入を得る場合があります
  • URLをコピーしました!

macOSではAppleが標準で提供している「辞書」アプリ(Dictionary.app)を利用することができます。

辞書アプリでは、大辞林(日本語)、英和・和英辞典、Apple用語辞典、Wikipediaなど、macOSに標準搭載されている辞書を横断的に検索することができますが、対応している辞書はそれだけではありません。

少し作業が必要ですが、自分で辞書ファイルを作成し、辞書アプリから利用することもできるのです。

以下その方法を説明します。

Dictionary Development Kitを使って辞書を作成

macOSで自分専用辞書を作成するには「Dictionary Development Kit」を使用します。

https://developer.apple.com/download/more/から、「Additional Tools for Xcode 16.2」をダウンロードします(要Apple Developerアカウント。使用中のXcodeに一致したものをダウンロードします)。

ダウンロードしたdmgファイルを開き、中に含まれるDictionary Development Kitを任意のフォルダにコピーします。さらに、中に含まれるproject_templatesをコピーし、そのフォルダの中で作業します。

cp -a project_templates project_mydic
cd project_mydic

最低限、以下のファイルを編集します。

Makefile

最低限、 DICT_NAMEDICT_BUILD_TOOL_DIRを変更します。

DICT_NAME               =       "ソフトアンテナ辞書"
ICT_BUILD_TOOL_DIR     =       "/Users/sora/Documents/Dictionary Development Kit"

MyInfo.plist

辞書の諸情報を格納しているファイルです。最低限以下の情報が必要です。

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>CFBundleDevelopmentRegion</key>
    <string>ja</string>
    <key>CFBundleIdentifier</key>
    <string>com.softantenna.Dictionary</string>
    <key>CFBundleName</key>
    <string>ソフトアンテナ辞書</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0</string>
    <key>DCSDictionaryCopyright</key>
    <string>Copyright © 2025 softantenna</string>
    <key>DCSDictionaryManufacturerName</key>
    <string>softantenna</string>
</dict>
</plist>

MyDictionary.xml

辞書データの本体です。 d:entryが一つのエントリーに対応し、d:titleが見出し、d:indexが検索のキーとなります。

<?xml version="1.0" encoding="UTF-8"?>
<d:dictionary xmlns="http://www.w3.org/1999/xhtml" xmlns:d="http://www.apple.com/DTDs/DictionaryService-1.0.rng">
<d:entry id="w1" d:title="Voice Access">
  <d:index d:value="Voice Access" />
  <h1><b>音声アクセス</b></h1>
<p>音声コマンドでWindows PCを操作できるアクセシビリティ機能だよ。</p>
<d:entry></d:entry>
</d:dictionary>

インストール

ファイルの編集が終わったらmakemake installを実行してインストールします。make instlalだけだと辞書ファイルが更新されませんので注意が必要です。

$ make
"""/Users/sora/Documents/Dictionary Development Kit"/bin"/build_dict.sh"  "ソフトアンテナ辞書" MyDictionary.xml MyDictionary.css MyInfo.plist
- Building ソフトアンテナ辞書.dictionary.
- Checking source.
- Cleaning objects directory.
- Preparing dictionary template.
- Preprocessing dictionary sources.
- Extracting index data.
- Preparing dictionary bundle.
- Adding body data.
- Preparing index data.
- Building key_text index.
- Building reference index.
* Note: No reference index record.
- Fixing dictionary property.
- Copying CSS.
- Copying other resources.
- Finished building ./objects/ソフトアンテナ辞書.dictionary.
echo "Done."
Done.

$ make install
echo "Installing into ~/Library/Dictionaries".
Installing into ~/Library/Dictionaries.
mkdir -p ~/Library/Dictionaries
ditto --noextattr --norsrc ./objects/"ソフトアンテナ辞書".dictionary  ~/Library/Dictionaries/"ソフトアンテナ辞書".dictionary
touch ~/Library/Dictionaries
echo "Done."
Done.
echo "To test the new dictionary, try Dictionary.app."
To test the new dictionary, try Dictionary.app.

辞書アプリで自作辞書を検索

辞書アプリを開きます。

▲「設定」を選ぶと作成した辞書が表示されているはずです。チェックを入れます。

▲作成した辞書を選択して検索してみます。

▲辞書アプリで検索できればAlfredなどのツールでも検索できるようになっているはずです。Alfredで検索できない場合はMacを再起動してみるとうまくいくかもしれません

まとめ

macOSの辞書アプリで自作辞書を使用する方法を説明しました。辞書を作成するのは大変なように思えますが、実際にやってみるとそこまで複雑ではありません。自分専用の用語辞書などを作っておくと便利に活用できるかもしれません。

よかったらシェアしてね!
  • URLをコピーしました!
  • URLをコピーしました!