Deleting anki-error for macbook

I was trying to delete anki to get the latest version, but when I tried, it gave me an error saying (An error occurred. Please use Tools > Check Database to see if that fixes the problem.)

It also asked me to copy and paste the information below.

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. Please copy and paste the information below into your report.
Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Mac 10.16
Flags: frz=True ao=False sv=?
Add-ons, last update check: 2022-01-04 00:17:53

Caught exception:
Traceback (most recent call last):
File “aqt/main.py”, line 1069, in closeEvent
File “aqt/main.py”, line 463, in unloadProfileAndExit
File “aqt/main.py”, line 440, in unloadProfile
File “aqt/main.py”, line 550, in unloadCollection
File “aqt/main.py”, line 856, in closeAllWindows
File “aqt/init.py”, line 130, in closeAll
File “aqt/main.py”, line 548, in before_sync
File “aqt/main.py”, line 978, in maybe_auto_sync_on_open_close
File “aqt/main.py”, line 544, in after_sync
File “aqt/mediasync.py”, line 123, in show_diag_until_finished
File “aqt/main.py”, line 541, in after_media_sync
File “aqt/main.py”, line 436, in callback
File “aqt/main.py”, line 445, in _unloadProfile
File “aqt/profiles.py”, line 218, in save
File “anki/db.py”, line 47, in execute
sqlite3.OperationalError: attempt to write a readonly database

It seems that the database file only has readonly permission.
Try going in the directory of the database, and doing executing ls -l to ensure if this is true.
It’s weird that it even worked before you tried to remove anki. Does it work otherwise (writing to the database should happen quite often, not only when you try to delete Anki)?
This can be caused by several factors, among which:

  • you have accidentally manually changed that file permissions
  • some program has done this for you (maybe MacOS?)
  • your hard disk is starting to die, and thus your OS prevents you to write to it to extend its lifespan to allow you to make a backup

Anyways, if you only want to delete Anki, you just can just remove it by hand (warning: be sure you know what you are doing and have a backup before you screw up your data).

1 Like