Anki Can't Create Data Folder

Hello, my Anki was doing fine until a couple hours ago. Now when I try to open it, it says Anki could not create its data folder. Please see the File Locations section of the manual, and ensure that location is not read-only. I have a 2022 Macbook Pro and everything is updated on my end.

I saw the other posts on the forum and made sure everything said “Read and Write” in the files. I even allowed Full Disk Access, but it is still not working. I tried downloading an older version of Anki and it’s still the same issue. I redownloaded Anki and it still gave me the same message.

Please help, thank you!!

That message appears when Anki is unable to write to the folder where profiles are kept.

In anki/ftl/core/profiles.ftl:

profiles-could-not-create-data-folder = Anki could not create its data folder. Please see the File Locations section of the manual, and ensure that location is not read-only.

On a Mac computer, the default profile directory is:
~/Library/Application Support/Anki2/User 1 (using the shorthand “~”, or:)
/Users/<your_username>/Library/Application Support/Anki2/User 1

You might want to check the permissions and ownership of that directory and its parent directory. Via the Terminal app:

ls -ld ~/Library/"Application Support"/Anki2/"User 1"
ls -ld ~/Library/"Application Support"/Anki2/

On my Mac, doing so shows me that I am the owner of both directories, and I have full rwx read, write, and execute permissions for both directories:

drwxr-xr-x@ 9 myusername  staff  288 Mar 28 06:06 /Users/myusername/Library/Application Support/Anki2/User 1
drwxr-xr-x@ 9 myusername  staff  288 Mar 28 05:36 /Users/myusername/Library/Application Support/Anki2

(There’s also another way to look at file permissions using the Finder: menu bar > Go > Go to Folder…, and then menu bar > File > Get Info)

When I look for ~/Library/Application Support/Anki2/User 1, nothing shows up and when I checked on terminal, it shows: ls: /Users//Library/Application Support/Anki2/User 1: No such file or directory

drwxr-xr-x@ 4 staff 128 Apr 1 02:51 /Users//Library/Application Support/Anki2/

~ %

Which doesn’t make sense because I see Anki in my applications and I downloaded it properly.

Note the two slashes in Users//Library. Between the two slashes is where the username should be. But, there is nothing between the two slashes. It seems that directory is owned by a user with no username.

Also, right before staff there should be a username. But, the username seems to be missing.

It might be possible that your account has no username, which is not normal.

In the Terminal app, running:

  • id -nu should print out your username (Is it blank?)
  • id -u should print out your UID number (What is it?)

Or, perhaps you aren’t that no-name user, but Anki got installed by that user. Do you log into your MacBook Pro using different accounts or using a guest account or as a guest user?

Oh, sorry, it has my user name (which is my full name) in it, I just deleted it before replying for privacy sake. So it said:

ls: /Users/my username/Library/Application Support/Anki2/User 1: No such file or directory

drwxr-xr-x@ 4 my username staff 128 Apr 1 02:51 /Users/my user name/Library/Application Support/Anki2/

My user name@my name-MacBook-Pro-2 ~ %

I’m the only one using my Macbook and I only have one account

Could you please run the ls -l ~/Library/"Application Support"/Anki2 command, to view the contents of the Anki2 directory?

The contents should look like:

% ls -l ~/Library/"Application Support"/Anki2 
 ls -l
total 32
drwxr-xr-x@ 2 myusername  staff     64 Oct 31 13:51 addons21
drwxr-xr-x@ 2 myusername  staff     64 Oct 31 13:51 logs
-rw-r--r--@ 1 myusername  staff  12288 Oct 31 13:51 prefs21.db
-rw-r--r--@ 1 myusername  staff    187 Oct 31 13:51 README.txt
drwxr-xr-x@ 5 myusername  staff    160 Nov  1 09:38 User 1

The User 1 directory is the profile directory where Anki was trying to write into. “User 1” is the name of the default profile that comes with Anki. However, if you’ve renamed your profile to something else, then the directory name will be the name of the profile, not “User 1”. I’m interested in seeing if that might be the case.

(And, if it is the case that the profile has been named something different, you might be able to switch back to it in Anki menu bar > File > Switch Profile, and then in the Profiles window that pops up, select the desired profile and Open it. I’d be interested in knowing what profile names you see in the Profiles window.)

This is what I got:

my name@my name-MacBook-Pro-2 ~ % ls -l ~/Library/“Application Support”/Anki2

total 32

-rw-r–r–@ 1 my name staff 12288 Apr 1 11:26 prefs21.db

-rw-r–r–@ 1 my name staff 512 Apr 1 11:26 prefs21.db-journal

my name@my names-MacBook-Pro-2 ~ %

I’m assuming my file was changed to something else and not User 1? I can’t open Anki at all, so I can’t access the Anki file to check the profile name.

Are you saying that you’ve been using Anki for the past few weeks/months and just started to encounter problems today?

If so, then I’m concerned because your Anki collection, your decks and media, seem to be missing. Normally, the Anki collection is stored in the profile directory in the Anki2 directory. But, the contents of ls -l in the Anki2 directory shows that there is no profile directory. So, unless I’ve misunderstood something, your decks and media (and backups) seem to be missing.

We might want to pause troubleshooting temporarily to look for your missing collection and make sure it is secure before continuing.

  • Do you have other devices that you use Anki on, that might have an intact copy of your collection?
  • Or, do you sync to Ankiweb, and does Ankiweb have an intact copy of your collection.
  • Or, do you have a backup copy of your collection that you manually exported and saved?
  • Or, were you previously using an older version of Anki that stored your collection in ~/Documents/Anki instead of in the Anki2 directory?

Yes, I’ve been using Anki for a couple months now and I just encountered this issue when I tried to reopen Anki last night.

I sync to Ankiweb and Ankiweb has my current decks. I also have the Anki app that I have synced as well so I’ve been using that to review.

Okay, because securing your collection doesn’t seem to be a concern, we’ll work on fixing the issue.

I’m wondering if deleting both the Anki2 and AnkiProgramFiles directories and then re-installing Anki might help?

# To delete the directories:
rm -rf ~/Library/"Application Support"/Anki2
rm -rf ~/Library/"Application Support"/AnkiProgramFiles

# Sanity check to verify that the directories were actually deleted.
# Should result in a "No such file or directory" message
ls ~/Library/"Application Support"/Anki2
ls ~/Library/"Application Support"/AnkiProgramFiles

The Anki2 directory is where your collection is stored. (Normally we would want to rename it rather than deleting it, to save a copy of your collection just in case. But, since your collection doesn’t seem to be there and there’s nothing to save, it should be okay to just delete the directory.)

The AnkiProgramFiles directory is where the Anki program is installed. Deleting the directory is like uninstalling Anki.

The “Anki” that you see in your Applications is actually the Anki Launcher, a smaller program that is used to install and run Anki. It isn’t the actual, main Anki program.

With both Anki2 and AnkiProgramFiles directories gone, it would be just like a system that where Anki had never been installed. Running the Anki Launcher should then bring up the Terminal menu allowing you to install Anki. Basically, it would be like a fresh installation.

Oh my goodness, thank you so much!! I did that, and it works now!!!

I’m unfortunately having the same issue again…

I did the same thing as before, deleting the files and redownloading Anki but I still get the "Anki could not create its data folder. Please see the File Locations section of the manual, and ensure that location is not read-only." pop up.

You should start from the top and verify all of the permissions again. Is it possible your computer removed the permissions from before? Because Anki couldn’t do that on its own, and it sounds like it’s been working for the past few weeks.

It has been working for the last couple weeks, but I went to open it this morning and got the same pop up. It’s the exact same issue as before, and I have read and write enabled for Anki so I’m not sure what the issue is this time around and why deleting the files and redownloading isn;t working :frowning:

Could you please provide the output of the following Terminal command?
ls -l ~/Library/"Application Support"/Anki2

Edit: Added:

Could you also please tell us anything about any possible way that you are using your MacBook Pro that might be different than other people? For example:

  • Are you using any cloud storage/backup services?
  • Are you using any external drives?
  • Have you ever changed your username on your computer?
  • Are you using any Mac cleaner apps?

Last login: Fri Apr 24 12:39:19 on ttys000

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

total 32

-rw-r–r–@ 1 erin staff 12288 Apr 24 12:42 prefs21.db

-rw-r–r–@ 1 erin staff 512 Apr 24 12:42 prefs21.db-journal

erin@Erins-MacBook-Pro-2 ~ %

I don’t think I have anything different than other people on my Macbook. It is being backed up via iCloud. I don’t use an external drive, I don’t think I ever changed my username, and no Mac cleaner app.

Thank you. Could you please provide the output of this command?
ls -ld ~/Library/"Application Support"/Anki

ls: /Users/erin/Library/Application Support/Anki: No such file or directory

erin@Erins-MacBook-Pro-2 ~ %

Not sure what is wrong because I have Anki downloaded, and there’s a folder for Anki and AnkiProgramFiles in Application Support

Sorry, I accidentally left off the last character during my copy/paste. This is the command I wanted:
ls -ld ~/Library/“Application Support”/Anki2

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

ls: /Users/erin/Library/"Application: No such file or directory

ls: Support"/Anki2: No such file or directory

erin@Erins-MacBook-Pro-2 ~ %