Duplicati as a Service - macOS


Tested with Duplicati 2.0.2.13 on macOS 10.13.1.

This assumes you've already downloaded the latest Duplicati and extracted it to /Applications.

Close/exit Duplicati if it is running before trying to run it as a service.

I gathered the original plist info from here: https://forum.duplicati.com/t/macos-osx-service-installation/968/


To run Duplicati as a background service:

Create this file:

/Library/LaunchDaemons/net.duplicati.server.plist

Add these contents to the file:

<?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>net.duplicati.server</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Applications/Duplicati.app/Contents/MacOS/duplicati-server</string>
        <string>--webservice-port=8200</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>LaunchOnlyOnce</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
</dict>
</plist>

Start the service: (as root)

launchctl load -w /Library/LaunchDaemons/net.duplicati.server.plist

To run the tray icon as a service:

Create this file:

/Library/LaunchAgents/net.duplicati.tray-icon.plist

Add these contents to the file:

<?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>net.duplicati.tray-icon</string>
    <key>ProgramArguments</key>
    <array>
        <string>open</string>
        <string>/Applications/Duplicati.app/</string>
        <string>--args</string>
        <string>--hosturl="http://localhost:8200"</string>
        <string>--no-hosted-server</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

Start the program: (as user)

launchctl load -w /Library/LaunchAgents/net.duplicati.tray-icon.plist

With Duplicati running as root, it will use this location for its database and configuration:

/var/root/.config/Duplicati

It may use this location if it tries to access anything via its local path (i.e.: you forget to specify an absolute path for backups):

/Applications/Duplicati.app/Contents/Resources

Due to its nature of being a .NET/Mono program, Duplicati's process will show up as mono-sgen64.