I'm trying to launch a command line app from my objective C application (sandboxed) using NSTask and I keep getting "launch path not accessible"
Here is the path: [task setLaunchPath:@"/usr/local/bin/codeview"];
I have set the appropriate attributes for codeview and it is working perfectly when I use it from the command line and /usr/local/bin IS in the $PATH
I know I have NSTask configured correctly because this WILL work: [task setLaunchPath:@"/usr/bin/hexdump"];
With the exception being that I'm using a command already in /usr/bin. But I can't copy codeview into /usr/bin due to SIPS.
I've tried moving codeview to various other non-SIPS protected locations all to no avail. Must all NSTask commands come from /usr/bin? Where might I put codeview so that it can be launched.
Today I'm going to use an older computer and disable SIPS to put my command in /usr/bin and see if that works. If it does. I will do it on my main machine.
What are you trying to do - at a high level?
The application sandbox restricts access to certain paths. That's the whole idea. If an executable is already part of the operating system, then you can probably access it. However, command-line tools may not run properly from the sandbox.
Normally what you would do in this situation is include the "codeview" binary, if possible. Another option would be to give the user the option to specify executables to run. Then the user could select that path in /usr/local. But again, you have to hope the tool works when running in the sandbox.