I've suddenly started getting an error on all versions of Python on MacOS reporting the following when using subprocess
:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/sbin/sysctl -n machdep.cpu.brand_string'
However, /usr/sbin/sysctl
does exist, I can run the command myself, under my normal user, without any issue - just not with a Python interpreter. When launching a Python interpreter owned by root I don't get this issue.
The permissions and ownership are reported as the following:
-rwxr-xr-x 1 root wheel 135296 Oct 28 09:43 /usr/sbin/sysctl*
Changing the permissions/ownership doesn't appear possible even undo sudo
anyway; as Operation not permitted
is reported.