I habe installed Anki both on my Macbook and on my Windows PC.
First in Windows I built a card template cloned from the Basic template, and in the Back template I added the text as below:
In Windows the Anki app can play the card using tts normally. But after I synchronized the cards templates and cards using AnkiWeb and and played them in MacOS, an error message poped:
# Error An error occurred. Please use Tools > Check Database to see if that fixes the problem. If problems persist, please report the problem on our [support site](https://help.ankiweb.net). Please copy and paste the information below into your report. Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 5.14.1 PyQt 5.14.1 Platform: Mac 12.6 Flags: frz=True ao=False sv=2 Add-ons, last update check: 2022-09-18 17:35:33 Caught exception: Traceback (most recent call last): File "aqt.webview", line 568, in handler File "aqt.reviewer", line 730, in _onTypedAnswer File "aqt.reviewer", line 401, in _showAnswer File "aqt.sound", line 150, in play_tags File "aqt.sound", line 209, in _play_next_if_idle File "aqt.sound", line 212, in _play File "aqt.sound", line 223, in _best_player_for_tag File "aqt.tts", line 111, in rank_for_tag File "aqt.tts", line 76, in voice_for_tag File "aqt.tts", line 72, in voices File "aqt.tts", line 190, in get_available_voices File "subprocess", line 505, in run File "subprocess", line 951, in __init__ File "subprocess", line 1821, in _execute_child FileNotFoundError: [Errno 2] No such file or directory: 'say'
I find that “say” is the command in MacOS for tts, and its full path is “/usr/bin/path”, but the execution path list(the PATH environment variable) of the Anki app in MacOS doesn’t contain “/usr/bin”, but it contains “/usr/local/bin”. After I ran the following command in terminal, everything went well:
sudo ln -s /usr/bin/say /usr/local/bin/say
I think the problem is that in some cases in MacOS the PATH environment variable for GUI applications is different from that of the terminal, the former doesn’t contain “/usr/bin” and the latter contains “/usr/bin”. So there is a method to solve this problem: on the start of the Anki desktop app, check if the running OS is Macos, and if yes, check if the PATH environment variable contains “/usr/bin”, if no, add “/usr/bin” to the PATH environment variable.
The used Anki installation image is anki-2.1.54-mac-intel-qt5.dmg. The OS version is macOS Monterey 12.6.