Skip to content

Run Profinity as a macOS service

Run Profinity as a launchd service on macOS to start it automatically on boot and restart it if it fails. Install Profinity first, as described in Install Profinity on Linux and macOS. For the licence that opening the web interface from another machine needs, refer to Run Profinity as a service.

On macOS, Profinity is installed with the same bootstrap installer as Linux, into /opt/profinity by default, and launchd runs it as a service in the role systemd fills on Linux.

The plist and commands in these steps are an example only. Prohelion does not ship a launchd plist for Profinity, so check the labels, paths, and options against your own installation before you load the service.

  1. Create a plist file:

    sudo nano /Library/LaunchDaemons/com.profinity.service.plist
    
  2. Add these contents, adjusting /opt/profinity if you installed with --install-dir:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.profinity.service</string>
        <key>ProgramArguments</key>
        <array>
            <string>/opt/profinity/profinity.sh</string>
            <string>-b</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
        <key>KeepAlive</key>
        <true/>
    </dict>
    </plist>
    
  3. Load the service:

    sudo launchctl load /Library/LaunchDaemons/com.profinity.service.plist
    
  4. Start the service:

    sudo launchctl start com.profinity.service
    

The plist uses -b (--background), which logs to a file and the console instead of depending on an interactive console session. It does not use -s (--service), which selects service-mode host integration only on Windows and Linux (systemd). Always start Profinity through profinity.sh, because it also bootstraps the .NET runtime for the portable macOS build when needed.

To check that the service is running, run sudo launchctl list | grep com.profinity.service. The command lists the service when it is loaded. The first column shows its process ID while it is running, and the second column shows the last exit status of the job.

What you see Cause What to do
The service does not start A fault stops Profinity during start-up. The reason is written to the daily log file, because launchd discards console output unless the plist sets StandardOutPath and StandardErrorPath. Read the profinity_<date>.log file in the logs folder of the artefacts directory (refer to Artefacts directory). Launchd discards console output unless you add StandardOutPath and StandardErrorPath keys to the plist
A "file not found" error The path to profinity.sh in the plist does not match where Profinity is installed Correct the path in the plist, then reload the service as described in Apple's launchd documentation

Next, refer to Apply a licence to apply a Server licence.