MacOS – sudo: setrlimit(8): Invalid argument

catalinamacossudo

After updating to Mac OS Catalina some months ago, I followed the prompted suggestions and changed my shell from BASH to ZSH.

Since that time, whenever I use sudo in Terminal, I get sudo: setrlimit(8): Invalid argument. The sudo'd command runs fine, but this error shows every time.

I don't have any plugins or modifications to my shell – it's vanilla ZSH in default Terminal.app

Can't upgrade sudo to new version. I download the file sudo-1.8.31.mac1015.pkg and install it, but remain the same version
Sudo version 1.8.29
Sudoers policy plugin version 1.8.29
Sudoers file grammar version 46
Sudoers I/O plugin version 1.8.29

Best Answer

Have you checked your PATH?

I just installed sudo-1.8.31.mac1015.pkg and found out that the package installs sudo to /usr/local instead of the default /usr.

If you are not sure, run which -a sudo, the one at the top will be used. To override, just add

PATH="/usr/local/bin:$PATH"

to your ~/.zshrc