Before attempting to fix this error double check the syntax to ensure the command you’re trying to run is correct. If you haven’t done so yet you’ll need to enable the root user, this may be all that’s needed to fix the error.
If the command is still not working it can mean it is not installed, deleted or in the worst cases the system directory has been deleted or modified. However, the most common reason for this error is an issue with $PATH.
What is $PATH?
PATH is an Environment Variable that contains a list of directories that tells your system where to look for executable programs. To find the value of your PATH variable type the following command into the terminal:
To set $PATH to the default Mac OS path use the following command:
This should be all that’s needed to fix the “sudo: command not found” error.