Mac 版 Anki 安装 AnkiConnect 插件后连接失败解决方法

最近使用 Anki 记忆 COCA 词汇时,碰到此问题。

  • 使用 Chrome 上的 Anki 取词插件(比如我用的 Online Dictionary Helper) 时,将单词添加至新卡片的功能需要依靠 AnkiConnect 插件连接桌面客户端与取词插件。
  • 由于 Mac 系统的机制,会导致 Anki 客户端处于后台时,AnkiConnect 的进程被挂起。
  • 结果是取词插件设置页面检测不到 AnkiConnect,或者检测到并设置好后短时间内连接又断开。
  • 打开终端执行下面三行命令

解决方法如下:

defaults write net.ankiweb.dtop NSAppSleepDisabled -bool true
defaults write net.ichi2.anki NSAppSleepDisabled -bool true
defaults write org.qt-project.Qt.QtWebEngineCore NSAppSleepDisabled -bool true
  • 重启 Anki 客户端

官方文档原文:

Notes for Mac OS X Users

Starting with Mac OS X Mavericks, a feature named App Nap has been introduced to the operating system. This feature causes certain applications which are open (but not visible) to be placed in a suspended state. As this behavior causes AnkiConnect to stop working while you have another window in the foreground, App Nap should be disabled for Anki:

  1. Start the Terminal application.
  2. Execute the following commands in the terminal window:
    • defaults write net.ankiweb.dtop NSAppSleepDisabled -bool true
    • defaults write net.ichi2.anki NSAppSleepDisabled -bool true
    • defaults write org.qt-project.Qt.QtWebEngineCore NSAppSleepDisabled -bool true
  3. Restart Anki.
(Visited 2,080 times, 1 visits today)

5 Comments

  1. Avatar zhou paul 10/04/2019 at pm11:21

    感谢!

    Reply
  2. Avatar Shuang Cao 09/05/2019 at am10:34

    您好,我在跑完这三行命令之后在当前网页可取词,但换了个网页又不行了。请问您有同样的问题吗?是否需要在每打开一个网页就要重新运行这三行命令呢?谢谢!

    Reply
    1. Avatar zhou paul 10/04/2019 at pm11:21

      可能是你另一个网页需要刷新一下,重启一下浏览器试试。

      Reply
      1. Avatar mabutou 10/04/2019 at pm11:31

        哈哈你挺热心,我之前回复过 Shuang Cao 了。因为那条回复里我有留微信号,所以她问题解决后我就删掉了回复。

        Reply
        1. Avatar zhou paul 10/06/2019 at pm6:13

          哈哈 顺手回一句 ? 博主这篇文章很实用,多谢分享哈!

          Reply

Leave A Comment

Your email address will not be published. Required fields are marked *