I have a command line application (not .app bundle), a single executable file. It runs from e.g. usr/bin/myapp
. This should be accessible by all users in the mac. It is a LaunchDaemon and run as a as root
user. If I keep it in usr/bin
it works fine.
When a user install the app, pkgbuild
copy the file to /usr/bin
and postinstall
script starts the LaunchDaemon.
The app depends on nss
library. so now I need to copy the nss binary and dylib files to somewhere e.g. usr/bin/lib/nss
folder. Is it possible to do using pkgbuild
or preinstall
script? Since pkgbuild --install-location
set to /usr/bin
will copy myapp
there, but how to copy nss folder to usr/lib
?
The other option is to make a whole folder structure /usr/bin/MyApp
and copy my myapp
binary file there and keep nss
files at /usr/bin/MyApp/nss
folder. But is that a good idea?
Or should I make the file structure at /usr/local/MyApp
?
Which is the best location to run myapp LaunchDaemon as a root user?
/usr/local
or usr/bin
or some other place?