0

What is the path to the global directory (for example: /usr/local/bin etc.) for binary files in macOS?

The problem is that I can run the command from another user. With this command I want to start the Caddy web-server: su _www -c caddy

I know where this file is located. The problem is that Caddy can only work with php socket if the Caddy process is run as user _www. But if I switch to _www user (this is not a problem), I can not start the process, because the Caddy file is in the PATH of another user.

Of course I can send the file to another user to run, but this is too long and inconvenient process. I just need to start the process from the right user. In Ubuntu, such a problem is not surprising.

OS: MacOS High Sierra 10.13.1

  • There are dozens of directories where macOS can legitimately have executables. I would use spotlight or locate to find an arbitrary executable like the one you mention since it’s not installed part of the core OS. mdfind "kMDItemFSName == caddy" locate caddy – bmike Nov 25 '17 at 23:44
  • I know where this file is located. The problem is that Caddy can only work with php soket if the Caddy process is running from the user _www. But if I switch to _www user (this is not a problem), I can not start the process, because the Caddy file is in the PATH of another user. – Dmitry S. Nov 25 '17 at 23:51
  • All the mention of path obscured you really had a SU issue. My apologies @kryptoncode Can you edit your su command to explicitly call the correct full path to the tool? Unless you really want to run this manually, I’d use a tool like LaunchCtl or Lingon to craft a proper launch daemon file to specify how / when you start that process and it can change the user for you much better than su – bmike Nov 25 '17 at 23:55
  • I get this error. Caddy has its own daemon. No need to use something third-party. – Dmitry S. Nov 26 '17 at 0:10
  • Now you’re on something @kryptoncode - you’ll need to add _www to the group permissions for all the places you stored the program and it needs to write. I’m presuming you have an executable somewhere other than the pastebin since you have no program there to run. forum.caddyserver.com/t/unable-to-run-caddy-as-a-daemon/2364 – bmike Nov 26 '17 at 0:20
0

The problem is solved. It was enough to put a binary file Caddy in the directory: /usr/local/bin

If the binary file is in the directory /usr/local/bin, Caddy available for reading for user _www

You must log in to answer this question.

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