Where apps hide your files
Anki stores every deck, card and review in a single collection file inside a per-profile folder in Application Support. Here is where it is, what the other files do, and how to back it up without corrupting it.
Anki's base folder on a Mac is:
~/Library/Application Support/Anki2
Each profile has its own subfolder named after the profile, for example Anki2/User 1. Inside it:
~/Library/Application Support/Anki2/User 1/collection.anki2
~/Library/Application Support/Anki2/User 1/collection.media/
~/Library/Application Support/Anki2/User 1/backups/
collection.anki2 holds your notes, decks and cards. collection.media holds the audio and images those cards use. This layout comes from the Anki manual and matches the names in Anki's source code. Your profile folder will not be called User 1 if you renamed it.
Anki's data folder is inside the hidden Library. In Finder press ⇧⌘G and paste the base path. In Terminal:
open ~/Library/Application\ Support/Anki2
To see which profile folders you have, list the base folder (this only reads):
ls ~/Library/Application\ Support/Anki2
The base folder also holds program-level files. The preferences database is called prefs.db in the manual, but current Anki's source code names it prefs21.db, so expect that name on disk. Add-ons live in addons21 in the same base folder, and the surest way to reach one is from Anki itself: Tools > Add-ons, select an add-on, then View Files. The manual says not to move or edit the other files in the folder, so leave them alone.
The manual is firm that you should not copy or move your collection while Anki is running. The collection is a live database, and a copy taken mid-write can be damaged. Quit Anki completely (⌘Q) before copying anything from this folder.
Use Anki's own features first.
.colpkg, do a one-way sync download or run Tools > Check Database. Older ones are thinned out once they are two days old, and you choose how many daily, weekly and monthly copies to keep.From File > Switch Profile, click Open Backup and choose the backup. Anything you did after that backup is lost, and Anki turns off sync and backups during the restore, so restart it afterwards. A manual .colpkg export is restored with File > Import.
The tidy route is to export a .colpkg with media, install Anki on the new Mac, and import it. If you prefer to copy folders, quit Anki on both machines and copy the whole Anki2 folder across, so the profile list in prefs21.db comes with the profiles. Check the card count and a few media cards afterwards.
Anki can start with a different base folder. From Terminal:
open /Applications/Anki.app --args -b ~/myankifolder
The manual also lists an ANKI_BASE environment variable, and -p <name> to open a specific profile. This is handy for a second collection or for keeping data on an external drive.
The collection file itself is usually small. Media is what grows, especially with audio and image-heavy decks. Tools > Check Media lists media files no card uses, and files cards refer to that are missing, and lets you delete the unused ones from inside Anki. Use it instead of deleting files from collection.media by hand, which can leave cards with broken references.
You may end up with three versions of the same deck: the live collection, automatic backups and a .colpkg you exported last term. The live one changes every time you review a card, so it is always the newest. A backup is a snapshot at a moment in time, and an export is a snapshot you chose. Before restoring anything, copy the current profile folder somewhere safe while Anki is closed, so that a restore you regret can itself be undone.
Also keep in mind that each profile is separate. If a deck seems to be missing after an update or a new install, check File > Switch Profile first, because Anki may simply have opened a different profile with no cards in it.
Spotlight does not index ~/Library, so searching for collection.anki2 finds nothing even though it exists.
When a profile will not open and you need the files now, typing collection.anki2 into Everywhere lists the live collection of every profile, and colpkg lists the exports you have saved; any in Documents, Downloads, iCloud Drive or on an external drive appear once it has Full Disk Access, which macOS requires for those places. Press ⌘↵ to reveal the match in Finder. It searches file names only, not the cards inside, and it does not repair or restore anything; it tells you where the file is.
In ~/Library/Application Support/Anki2, with one subfolder per profile containing collection.anki2, collection.media and a backups folder.
In a backups folder inside each profile folder, such as ~/Library/Application Support/Anki2/User 1/backups. Restore one with File > Switch Profile > Open Backup.
No. The manual says not to copy or move the collection while Anki is open. Quit Anki first, or export a .colpkg from the File menu.
Export a collection package (.colpkg) with media from File > Export, then import it on the new Mac with File > Import. Alternatively, sync through AnkiWeb.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised