How to show logs in Terminal with autostart enabled OSX?

Hi all,

I’m on OSX and I have Syncthing autostarting using the plist method as described in the docs.

http://docs.syncthing.net/users/autostart.html?highlight=autostart#mac-os-x

Sometimes I get sync errors and I want to just quickly look to see what files are causing the problems. So far I have been getting the debug logs by adding some commands to the plist (as suggested in the below link). The downfall is that I reboot the system to see the logs.

Can someone provide a step by step method on getting the logs to show up in Terminal? I’m a bit of a newbie, so please have patience :smile:

I see in the above thread that Syncthing can be started from Terminal to show the logs, but I couldnt get it to work.

This is what I tried.

  1. open terminal
  2. cd to folder with syncthing
  3. in terminal typed: syncthing -verbose I get this in terminal ‘-bash: syncthing: command not found’

What am I doing wrong?

It’s ./syncthing in the directory the binary is.

Thanks!

Now the only problem I get is this

FATAL: Cannot open database: resource temporarily unavailable - Is another copy of Syncthing already running?

I’ve tried to shutdown via the GUI and I get a ‘Shutdown is complete’ message but the FATAL error is still there. Any suggestions?

Well your shut down didnt work it seems, terminate it through the process manager and try again.

Nope. Cant kill the process either. It just keeps restarting after every forced quit :frowning:

So it’s the service daemon probably restarting it after you kill it.

You should do: sudo launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.syncthing.plist

then try killing it.

Sorry, I should have specified. I used the non-Homebrew method. So I just copied the .plist that came in the etc folder in the included binaries. I changed the user to my info and then copied that to launchdAgents folder.

I did try to use the:

sudo launchctl unload /Library/LaunchAgents/se.nym.syncthing.plist 

But I get this:

launchctl: Error unloading: se.nym.syncthing

I did:

sudo chown root <filename> 

and

 sudo chmod 644 <filename> 

To be able to run the launchctl commands.

This is what my plist looks like (minus the header):

<plist version="1.0">
	<dict>
		<key>Label</key>
		<string>se.nym.syncthing</string>
		<key>ProgramArguments</key>
		<array>
			<string>/Applications/Syncthing/syncthing</string>
		</array>
		<key>EnvironmentVariables</key>
		<dict>
			<key>HOME</key>
			<string>/Users/nori</string>
			<key>STNORESTART</key>
			<string>1</string>
		</dict>
		
		<key>KeepAlive</key>
		<true/>

		<key>LowPriorityIO</key>
		<true/>

		<key>ProcessType</key>
		<string>Background</string>
	</dict>
</plist>

Well the procedure for unloading the plist is the same, it’s just the path that is different.

Yes, I did change the path to my plist path. What I did to make sure the path was correct was I dragged the plist into Terminal.

But for some reason I get the error that it cannot unload. Terminal doesnt give any other explaination.

edit: I had to use the -w flag

sudo launchctl unload -w /Library/LaunchAgents/se.nym.syncthing.plist 

But killing the syncthing process in activity monitor still doesnt work. Always restarts. I have also noticed that shutting down via the GUI does nothing.

Well Syncthing is persistent. This is too much trouble. I can just stick with my old change the plist and reboot method.

Thanks for your help Audrius

LaunchControl http://www.soma-zone.com/LaunchControl/ is a fantastic GUI for launchd and lets you easily enable/disable items as well as load/unload.

Thanks so much for the suggestion on LaunchControl It worked like a charm :smiley: