If you are running Syncthing on macOS, you may see a menu-bar pattern line this:
See also Syncthing forum issue 24351 which was closed without an answer. Same problem.
I don't claim to understand Syncthing's internals but this condition appears to mean that there is a mismatch between the API keys in these two locations:
- Web UI: Actions » Settings » General » API Key
- Menu-bar UI: Syncthing » Preferences » API key
I encountered this problem on an M2 MacBook Pro running Sequoia 15.5. Once I realised what was going on, I tried the obvious approach of copying and pasting from one to the other:
- It is possible to copy the keys from both places;
- It isn't possible to paste a key into the Web UI;
- It is possible to paste a key into the Menu-bar UI but it doesn't seem to persist.
I decided to try some brute force. The steps below worked for me but YMMV:
-
In the Syncthing Web UI:
- Click Actions and choose Settings.
- Make sure the General tab is selected.
- Right-click on the "API Key" field and choose "copy". This places the value of the API Key on your clipboard.
- Close the browser window.
-
In the Syncthing Menu-bar item:
- Choose "Preferences..."
- Select the contents of the "API key" field.
- Right-click and choose "Paste". This replaces the key with the value copied in step 1.
- Click Test and confirm that the indicator changes from red to green.
- Click Quit Syncthing.
-
Launch Terminal and type (do not copy and paste) the following command without pressing return after you type the
=
:APIKEY=
Either press ⌘+v or choose "Paste" from the "Edit" menu. The result should be something like this:
APIKEY=jmn2mXzxxUnZyYzWqYubiLkFfvVVmgQJ
where the string after the
=
is your API Key from the Syncthing Web UI that you copied to the clipboard in step 1.Press return. This sets the
APIKEY
variable to the value of your API Key. -
Still in Terminal, run the following commands. You can either select all the commands as a group, copy them to the clipboard, paste into the Terminal window, then press return, or you can copy and paste one line at a time, pressing return after each command:
cd ~/Library/Preferences PLIST=com.github.xor-gate.syncthing-macosx.plist cp "$PLIST" "$PLIST.bak" plutil -extract "ApiKey" raw "$PLIST" plutil -replace "ApiKey" -string "$APIKEY" "$PLIST" plutil -extract "ApiKey" raw "$PLIST"
In words:
- Be in the right directory.
- Define a variable pointing to Syncthing's preferences file.
- Make a backup copy of the preferences file.
- Display the value of the API Key before the change.
- Edit the preferences file to update the API Key.
- Display the value of the API Key before the change.
If all goes well, you will see the change of value in the output from the two
plutil -extract
commands. -
Restart your Mac. When Syncthing launches after the restart, it should pick up the new API Key and the "Running (Offline)" should have gone away.
If you make a mess and need to undo the change, launch Terminal and run the following commands:
cd ~/Library/Preferences
PLIST=com.github.xor-gate.syncthing-macosx.plist
mv "$PLIST.bak" "$PLIST"
Restarting your Mac is advisable.
Once you are satisfied that everything is working, you can remove the backup file:
rm ~/Library/Preferences/com.github.xor-gate.syncthing-macosx.plist.bak