syncthing
brew install syncthing
Start on boot
Do this if you want syncthing to start without having to login in. It is useful on headless servers. This will start the syncthing daemon when your computer boots.
Create a new system LaunchDaemon plist file using sudo:
sudo vi /Library/LaunchDaemons/com.syncthing.syncthing.plist
Paste the following configuration into the file, replacing USERNAME with your output from whoami and /opt/homebrew/bin/syncthing with your output from which syncthing:
<?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>com.syncthing.syncthing</string>
<key>UserName</key>
<string>USERNAME</string>
<key>GroupName</key>
<string>staff</string>
<key>ProgramArguments</key>
<array>
<string>/opt/homebrew/bin/syncthing</string>
<string>serve</string>
<string>--no-browser</string>
<string>--no-restart</string>
</array>
<key>EnvironmentVariables</key>
<dict>
<key>HOME</key>
<string>/Users/USERNAME</string>
</dict>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>WorkingDirectory</key>
<string>/Users/USERNAME</string>
<key>StandardOutPath</key>
<string>/opt/homebrew/var/log/syncthing/syncthing.log</string>
<key>StandardErrorPath</key>
<string>/opt/homebrew/var/log/syncthing/syncthing-err.log</string>
</dict>
</plist>
Ensure standard system file permissions on the plist file:
sudo chown root:wheel /Library/LaunchDaemons/com.syncthing.syncthing.plist
sudo chmod 644 /Library/LaunchDaemons/com.syncthing.syncthing.plist
Load and enable the daemon:
sudo launchctl bootstrap system /Library/LaunchDaemons/com.syncthing.syncthing.plist
See the web interface
open http://127.0.0.1:8384
Check status
sudo launchctl print system/com.syncthing.syncthing
To disable
sudo launchctl bootout system /Library/LaunchDaemons/com.syncthing.syncthing.plist
Sharing device and folder
See device id
syncthing cli show system | jq .myID
Share device on both local and remote
# On remote
syncthing cli config devices add --device-id $LocalID
# On local
syncthing cli config devices add --device-id $RemoteID
Add a folder on local
FolderID=`dd if=/dev/urandom count=1024 2> /dev/null | sha1sum --quiet`
syncthing cli config folders add --label LABEL --path FOLDER --id $FolderID
Share folder to remote
syncthing cli config folders $FolderID devices add --device-id $RemoteID
On remote, check pending invitation
syncthing cli show pending folders
On remote, add folder and share it back
syncthing cli config folders add --id $FolderID --label LABEL --path FOLDER
syncthing cli config folders $FolderID devices add --device-id $LocalID