Anki Can't Create Data Folder

Sorry, there were “smart quote” characters in what I posted, instead of plain quotation marks. Please try this instead:
ls -ld ~/Library/"Application Support"/Anki2

Oops, sorry about that.

erin@Erins-MacBook-Pro-2 ~ % ls -ld ~/Library/“Application Support”/Anki2

drwxr-xr-x@ 4 erin staff 128 Apr 24 12:42 /Users/erin/Library/Application Support/Anki2

erin@Erins-MacBook-Pro-2 ~ %

Thank you.

I’m thinking that the error message “Anki could not create its data folder” is not entirely accurate and is a red herring.

Looking at the code in anki/qt/aqt/__init__.py and anki/qt/aqt/profiles.py, it seems like the error message is printed if one of a number of operations fail, including: creating the data folder, creating the prefs21.db database, reading the database, initializing Rust logging.

I’m wondering if the data folder is getting created just fine but one of those other things is causing the error instead. The data folder is the actual ~/Library/“Application Support”/Anki2 directory, and it seems that the directory gets created just fine (since it exists on the OP’s system).

I see that a prefs21.db-journal file exists in the OP’s Anki data folder. I don’t know whether that suggests that the problem is a sqlite database issue (causing Anki to quit before all the journaled database transactions could be processed) or if it is just an innocent side effect of the problem.

I’m also troubled with the way that the problem seems to suddenly appear after working fine for weeks/months.

I’m not sure what might be going on.

I just tried rm -rf ~/Library/“Application Support”/Anki2
rm -rf ~/Library/“Application Support”/AnkiProgramFiles and redownloaded Anki again, and it works now! Super weird, I tried it multiple times, and it didn’t work before. Not sure if there is something wrong with my laptop or what, but thank you for your help!

I’m glad that things are working for you again.

Since the problem is unexplained and seems to have come and gone mysteriously, I would make an extra effort to make sure you regularly backup/export your Anki decks and media files, just in case.

One possibility that I thought of was that perhaps there was some old, leftover/zombie Anki process running and accessing the database, interfering with further attempts to start Anki. If you encounter the issue again in the future, you might want to try rebooting your MacBook Pro (uncheck “Reopen windows when logging in”) to see if that might help.