OSX Daemon mode

When trying to mount on OSX using --daemon (background mode) the mount fails with the error:

Preformatted textrclone[24335]: background mode not supported on darwin platform

Of course, adding an ampersand at the end of the rclone mount command in Terminal also runs rclone in a kind of background mode.

But my understanding is that:

  • Using the ampersand only returns focus to the Terminal command prompt, but rclone is still linked to that instance of Terminal. So when you close Terminal, the linked rclone background process would also close.
  • Whereas using a real daemon makes the rclone service run independently of a Terminal instance.

Is this how the --daemon option works? Ie. creates an independent daemon?

If so, how hard is it to make this available for OSX as well?

That is more or less correct.

What --daemon mode does is detatch from the terminal. However you can do this manually - see this stack overflow question (not the first answer).

The reason why this doesn’t work on macOS is that the library rclone uses - go-daemon only works on macOS with cgo and I normally cross compile the binaries so they don’t have cgo support.

If you try one of the circleci builds it should work with --daemon: https://919-17803236-gh.circle-artifacts.com/0/tmp/rclone.dist/rclone-darwin-10.6-amd64

I had a look at the source for go-daemon and it looks relatively easy to make it stop depending on cgo. I made an issue there to discuss with the author: https://github.com/sevlyar/go-daemon/issues/40

OK thx again @ncw. I read your github issue and it does indeed look like go-daemon is not making heavy use of cgo.

Fingers crossed then that the authos of g-daemon is up for it!

The author has fixed it straight away!

Here is a beta with it in - let me know if it works :slight_smile:

https://beta.rclone.org/v1.41-013-gd6514b73-daemon_for_macos/ (uploaded in 15-30 mins)

1 Like

Just a quick note to acknowledge this - I am in the middle of a large transfer that should finish tomorrow and I will test it then.

Great - thanks! I’ll merge it to master once you’ve given it a test.

Apologies for the delay in testing - have been offline.

I have tested this on High Sierra and it doesn’t seem to work. After adding the --daemon flag to the mount command, the mount works fine but Terminal never returns the prompt. ie. Same as not using the --daemon flag.


Can you try the latest beta please? I re-merged from upstream so it may (or may not) fix the problem.

Tested with the latest beta and this appears to work:

  • Command prompt is returned to Terminal after mounting
  • Can close terminal and the Mount survives (including completely quitting Terminal from the Dock)
  • Can reopen a Terminal and umount at any time.

thx @ncw!

Good news - thank you for testing :smile: