How to pass —background to Web UI when not launched from the shell?

Picking up this thread, how to I enable background mode if I don‘t start the Web UI from the command line?

I use Duplicacy on macOS and have the „Start at Login“ option checked (via the toolbar icon menu). Obviously, there is no way to pass cmdline args there, so is there an alternative way?

The “Start at Login” option should already add the -background option. You can open the plist file ~/Library/LaunchAgents/duplicacy-web.plist to verify.

Hi @gchen,

Thanks for the suggestion. Unfortunately, my instance of Duplicacy Web does not behave as if the -background option is set.

This is my duplicacy-web.plist:

<?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>duplicacy-web</string>
    <key>ProgramArguments</key>
      <array>
        <string>/Applications/Duplicacy Web Edition.app/Contents/MacOS/duplicacy_web_osx_arm64</string>

      </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>⏎

I found a plist with the background option here.

I added the -background option to my plist, but when I restart Duplicacy, it still opens a browser tab.

Update:

When I uncheck “Start at login” and check that option again, Duplicacy deletes the plist and generates a new one.

The background option is already set in this new file. Nevertheless, the browser tab still opens.

What else can I try?

Hello @gchen ,

I also do have the same issue. In the .plist file the -background is stated, but the browser tab still opens though. No manual editing done to the file from my side.

Anything we can try, or is it a bug or still not working on macOS?

(My Duplicacy runs on macOS 14.1.2)

Dan

@ranger_dan did you mean the browser tab still opens on when macOS is booting up? Can you run the command with -background from the command line (after closing the current running Duplicacy instance)?

"/Applications/Duplicacy Web Edition.app/Contents/MacOS/duplicacy_web_osx_arm64" -background

Hi @gchen,

I tried starting the app via /Applications/Duplicacy Web Edition.app/Contents/MacOS/duplicacy_web_osx_arm64" -background. That worked out well, the web frontend in Safari did not start. But after rebooting the system, the “normal” starting procedure was as before - the web frontend launches Safari and shows the dashboard page.

How can I avoid that behavior?

This is my .plist file (some UUI codes shortened):

<?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>duplicacy-web</string>
    <key>ProgramArguments</key>
      <array>
        <string>/private/var/folders/9q/dl...gn/T/AppTranslocation/02...A1/d/Duplicacy Web Edition.app/Contents/MacOS/duplicacy_web_osx_arm64</string>
        <string>-background</string>
        
      </array>
    <key>RunAtLoad</key>
    <true/>
    <key>AbandonProcessGroup</key>
    <true/>
  </dict>
</plist>%                       

You can check if the app was started with the --background option by running this command in Terminal:

ps -Af | grep -i duplicacy 

Hi @chen,

obvoiusly not, this is what I’ve got:

  501  3308     1   0  6:45am ??         0:02.51 /Applications/Duplicacy Web Edition.app/Contents/MacOS/duplicacy_web_osx_arm64

Still the WebUI started after reboot. What else can I try?

After you modified the plist, did you reload it? Is this the only duplicacy plist you have?

Hello @saspus and @gchen,

I posted my .plist file here, it states the <string>-background</string>.

Maybe there is another .plist file (not created manually). Neither in ~/Library nor in /Library I have found one. How can this be found out?

Can you please answer this my question?

Also, why is the path to duplicacy not in /Applications/…?

Looks like you have started it from downloaded (unsafe) location instead of /Applications? App Translocation Notes | Apple Developer Forums

Hi @saspus ,

thanks for the quick reply.

I do not exactly know how to achieve this. What I have done:

  1. I have checked where my Duplicacy Web Edition.app is installed. Result: it is installed (correctly) in /Applications.
  2. I then edited ~/Library/LaunchAgents/duplicacy-web.plist and changed the path there to the proper one found under the path above.
  3. Reboot
  4. No change, WebUI started in Safari

Second try:

  1. I manually deleted ~/Library/LaunchAgents/duplicacy-web.plist
  2. I started Duplicacy via the Launchpad
  3. I have checked the “Lauch at Startup” option
  4. A new file ~/Library/LaunchAgents/duplicacy-web.plist was created, with the correct path to Duplicacy in /Application.
  5. Reboot
  6. Again, the WebUI started in Safari

Here is my updated .plist file (generated by Duplicacy, no manual editing):

<?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>duplicacy-web</string>
    <key>ProgramArguments</key>
      <array>
        <string>/Applications/Duplicacy Web Edition.app/Contents/MacOS/duplicacy_web_osx_arm64</string>
        <string>-background</string>

      </array>
    <key>RunAtLoad</key>
    <true/>
    <key>AbandonProcessGroup</key>
    <true/>
  </dict>
</plist>

I have also checked that the App Translocation passed, this was the case (thanks for the advice):

ps xw | grep Duplicacy  
  778   ??  S      0:00.77 /Applications/Duplicacy Web Edition.app/Contents/MacOS/duplicacy_web_osx_arm64

Any suggestions left?

Interesting.

Try this:

launchctl unload ~/Library/LaunchAgents/duplicacy-web.plist

Reboot. Make sure Duplicacy does not start (suspecting that there is more than one Duplicacy starting for some reason, and the second one just wakes the first), by checking process list ps aux | grep -i duplicacy

Once confirmed, verify that the plist still contains -background flag, and load it:

launchctl load -w ~/Library/LaunchAgents/duplicacy-web.plist

Duplicacy shall start without the browser and ps aux shall show -background in the argument list.

Hi @saspus ,

problem solved. Apparently a “second instance” was running. After I have unchecked “start at startup” option in the menu bar, manually quit Duplicacy, rebooted, I still hat a Safari screen opened.

There was an instance of Duplicacy listed in the “startup options” in System Preferences. After I have deleted that, Duplicacy runs as intended.

Thank you an @gchen for your help.

Dan.

1 Like