Quantcast
Channel: dictionaryタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 99

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

$
0
0

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

辞書.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フォルダにコピーしてみましたが、改善しませんでした。

そこで、正しく動作している他の辞書データと同様に /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!🎉🎉🎉

こちらからは以上です。


Viewing all articles
Browse latest Browse all 99

Trending Articles