LoginSignup
29
12

More than 3 years have passed since last update.

MacBook Pro (16-inch, 2019)で辞書.app(Dictionary.app)の英和/和英辞典が使えなくなった話。

Last updated at Posted at 2019-11-27

表題の通りの現象に遭遇して何とか解決したので、その記録です。

辞書.app(Dictionary.app)の環境設定から「ウィズダム英和辞典 / ウィズダム和英辞典 (日本語-英語)」を有効にしましたが、検索しても何も見つからない状態になりました。
スクリーンショット 2019-11-27 午後2.49.59.png
調べると同様の現象が発生している模様。
The macOS dictionary app cannot add new build in dictionaries - Apple Community

これによると、 /System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX フォルダにある com_apple_MobileAsset_DictionaryServices_dictionaryOSX.xml ファイルに辞書データのダウンロードURLがあるので、ここからダウンロードして.dictionaryパッケージを ~/Library/Dictionaries フォルダにコピーしたら直った、とのこと。

これを参考に com_apple_MobileAsset_DictionaryServices_dictionaryOSX.xml ファイルからウィズダム英和/和英辞典の辞書データのURLを探してみます。

<dict>
    <!-- ... -->
    <key>DictionaryPackageDisplayName</key>
    <string>ウィズダム英和辞典 / ウィズダム和英辞典</string>
    <!-- ... -->
    <key>__BaseURL</key>
    <string>http://appldnld.apple.com/osxassets/058-55450-2016008023-8A4D782E-661F-11E6-B483-D75733D2D062/</string>
    <key>__CanUseLocalCacheServer</key>
    <true/>
    <key>__InstallWithOS</key>
    <true/>
    <key>__RelativePath</key>
    <string>com_apple_MobileAsset_DictionaryServices_dictionaryOSX/1a184f41ee27bbb203ba596a25c8ea104c13d98f.zip</string>
</dict>

ファイル内にはこのような構造があり、 __BaseURL__RelativePath を繋げると辞書データのダウンロードURLになりそうです。ところが、同じ辞書について同じような構造が5つありました。 __BaseURL__RelativePath を見ると微妙に違っていてどうやらバージョン違いのようです。

<dict>
    <!-- ... -->
    <key>DictionaryPackageDisplayName</key>
    <string>ウィズダム英和辞典 / ウィズダム和英辞典</string>
    <!-- ... -->
    <key>__BaseURL</key>
    <string>http://appldnld.apple.com/osxassets/058-55450-2016008023-8A4D782E-661F-11E6-B483-D75733D2D062/</string>
    <!-- ... -->
    <key>__RelativePath</key>
    <string>com_apple_MobileAsset_DictionaryServices_dictionaryOSX/1a184f41ee27bbb203ba596a25c8ea104c13d98f.zip</string>
</dict>

<dict>
    <!-- ... -->
    <key>DictionaryPackageDisplayName</key>
    <string>ウィズダム英和辞典 / ウィズダム和英辞典</string>
    <!-- ... -->
    <key>__BaseURL</key>
    <string>http://appldnld.apple.com/ios11.0/048-04169-20171219-3E638938-E064-11E7-BED0-328EE988D09B/</string>
    <!-- ... -->
    <key>__RelativePath</key>
    <string>com_apple_MobileAsset_DictionaryServices_dictionaryOSX/69d9a5c927f04857f6abf7a0a9f144e194b5d0ce.zip</string>
</dict>

<dict>
    <!-- ... -->
    <key>DictionaryPackageDisplayName</key>
    <string>ウィズダム英和辞典 / ウィズダム和英辞典</string>
    <!-- ... -->
    <key>__BaseURL</key>
    <string>http://appldnld.apple.com/ios11.0/091-65654-20180306-F43DDB4C-1F01-11E8-B071-BA9988D28C9D/</string>
    <!-- ... -->
    <key>__RelativePath</key>
    <string>com_apple_MobileAsset_DictionaryServices_dictionaryOSX/3fb6544c58d7f04015ded27812a932cbbb3122ad.zip</string>
</dict>

<dict>
    <!-- ... -->
    <key>DictionaryPackageDisplayName</key>
    <string>ウィズダム英和辞典 / ウィズダム和英辞典</string>
    <!-- ... -->
    <key>__BaseURL</key>
    <string>http://updates-http.cdn-apple.com/2018/ios/091-97251-20180828-DB88F352-A4B7-11E8-A246-39142147FE1B/</string>
    <!-- ... -->
    <key>__RelativePath</key>
    <string>com_apple_MobileAsset_DictionaryServices_dictionaryOSX/c15aa908a684112f63017e47bb6b289e99977135.zip</string>
</dict>

<dict>
    <!-- ... -->
    <key>DictionaryPackageDisplayName</key>
    <string>ウィズダム英和辞典 / ウィズダム和英辞典</string>
    <!-- ... -->
    <key>__BaseURL</key>
    <string>http://updates-http.cdn-apple.com/2019/ios/041-71820-20190919-DB836C8E-DA9E-11E9-A9E0-C30E3E8547A6/</string>
    <!-- ... -->
    <key>__RelativePath</key>
    <string>com_apple_MobileAsset_DictionaryServices_dictionaryOSX/7725cba5b321a8308a603a40ac808699175c4aae.zip</string>
</dict>

どのURLか分からないので、 /System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX フォルダ内にある、正しく動作している他の辞書データの識別子がないか探してみると、 __BaseURLhttp://updates-http.cdn-apple.com/2019/ios/ で始まるところの __RelativePath のzipファイル名と一致します。

これでダウンロードすべきファイルは http://updates-http.cdn-apple.com/2019/ios/041-71820-20190919-DB836C8E-DA9E-11E9-A9E0-C30E3E8547A6/com_apple_MobileAsset_DictionaryServices_dictionaryOSX/7725cba5b321a8308a603a40ac808699175c4aae.zip であることがわかりました。

このファイルをダウンロード、展開して、 Assets フォルダにある Sanseido The WISDOM English-Japanese Japanese-English Dictionary.dictionary を前述の通り ~/Library/Dictionaries フォルダにコピーしてみましたが、改善しませんでした。

(12/30 追記: コメントより前述の記事に書かれている通り、コピー後.dictionaryファイルを違う名前にリネームするとうまくいくようです)

そこで、正しく動作している他の辞書データと同様に /System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX フォルダに置いてみます。とはいえ、 /System フォルダはEl Capitan以降導入されたSystem Integrity Protection(SIP)によって保護されているため通常はアクセスできません。そこで一旦これを無効にします。

やり方はこちら。
Configuring System Integrity Protection

To enable or disable System Integrity Protection, you must boot to Recovery OS and run the csrutil(1) command from the Terminal.

Boot to Recovery OS by restarting your machine and holding down the Command and R keys at startup.
Launch Terminal from the Utilities menu.
Enter the following command:
$ csrutil enable

まとめると、⌘+Rを押しながらリカバリモードで起動したあと、「ユーティリティ」メニューからターミナルを起動、 csrutil disable コマンドを実行して再起動します。

こうして、先ほどダウンロード、展開した 7725cba5b321a8308a603a40ac808699175c4aae フォルダを 7725cba5b321a8308a603a40ac808699175c4aae.assets にリネームして /System/Library/AssetsV2/com_apple_MobileAsset_DictionaryServices_dictionaryOSX フォルダにコピーし、念のため chmodchown -R でパーミッションと所有者を正しく動作している他の辞書データと合わせておきます。
また、リカバリモードで再起動して csrutil enable を実行、再起動して無効にしたSIPを有効にしておきます。

そして、辞書.appを起動してみると…。
スクリーンショット 2019-11-27 午後3.00.48.png
Hooray!🎉🎉🎉

こちらからは以上です。

29
12
7

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
29
12