For some reason my I can't run sudo, every time I try, I just get the error sudo: unable to open /var/db/sudo/ts/user: Invalid argument

The folder listed in the error (/private/var/db/sudo) is completly empty, which explains why I can't run sudo, but how can I fix it, without sudo?

Things I already tried and other notes:

· Creating new (admin) account: still same error

· Both USB-ports are broken, so know backup of whole system possible (most important files still saved in cloud)

· I'm aware that I can reinstall OSX via ⌘+R or ⌘+⌥+R

  • 1
    Hi. Could you edit a little more detail into the question ? I could see you making a new admin account and then making a backup before you run into more sudo issues. Or if you have a backup, it might be trivial to reinstall the os and restore. What precise sequence was the fix? If you don’t know that, restoring might be a safer bet.
    – bmike
    Feb 28, 2018 at 15:35
  • 1
    Backups are impossible right know, cause both of my USB-Ports are broken... I'll try to edit my question a bit, but thx for quick response
    – Nanogamer7
    Feb 28, 2018 at 15:40
  • 1
    Yikes. If you don’t mind losing all the data, then let’s see what people have to say. Thunderbolt or FireWire or network can also work to back up files if you’re more interested in saving things before potentially erasing / breaking further and forcing your hand on an erase install.
    – bmike
    Feb 28, 2018 at 16:08
  • 1
    What options for Thunderbolt backups are you thinking about (except NAS)?
    – Nanogamer7
    Feb 28, 2018 at 16:10
  • 1
    Is it possible to use an external drive connected to another mac via Thunderbold?
    – Nanogamer7
    Feb 28, 2018 at 16:15

1 Answer 1


Reinstalling the OS will fix /private/var and may well be needed. I’d start there, and test sudo again.

Next consider booting to single user mode and make a new admin user by removing one file only - rm /var/db/.AppleSetupDone

Then you’ll know if sudo and your admin account and system are operational or you need to erase and start over to restore files from a backup.

Neither of the above steps will erase any files you have - just will correct system files and create a new user with clean admin permissions and home folder. That doesn't mean if your drive is failing, this won't erase everything or your drive is immune to failure - just that Apple macOS install doesn't erase any user data or settings - it's designed to upgrade everything in place and fix things. You have to jump through lots of hoops with warnings to erase and then install. A normal install is designed to be safe to your data.

  • 1
    Thanks for answer. I have no time right know but I'll test and confirm tomorrow... Are you sure it wont erase any userdata? Or should I not risk it and (try to) make a backup anyways
    – Nanogamer7
    Feb 28, 2018 at 19:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .