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

1 Answer 1


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


to your ~/.zshrc

  • 1
    @ManuelBustamante If that worked, why not consider marking this answer as accepted, so that it will help more people :-)
    – M. Zhang
    Commented Mar 19, 2020 at 1:12
  • I had the same issue, so I also installed the newer sudo. I already had my path set to have /usr/local/bin before /usr/bin and which -a sudo shows the new one appearing first - yet I still use the one from /usr/bin instead of the new one. Commented May 1, 2020 at 10:30
  • I ended up rebooting my mac, and now I'm getting the proper version of sudo. Commented May 1, 2020 at 10:43

You must log in to answer this question.

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