Starting Agent on macOS when system boots up or user logs in
There are several ways to force Agent starting automatically, each with its own advantages and drawbacks.
- Adding agent to Login items
- Registering agent as Launch Agent
- Registering agent as Launch Daemon
Adding agent to login items is simple to do, though your Mac won't track the agent status and won't restart it if it gets abnormally terminated. To stop the agent launched in that way simply right-click it in your dock and pick "Quit"
Follow the steps below:
- Mount the Resilio-Connect-Agent.dmg and drag the Resilio Connect Agent.app into /Applications folder
-
Open your Mac System Preferences -> Users and groups -> Login items
-
Click the "+" button and navigate to Resilio Connect Agent app, confirm your choice
- Once done, your Mac will launch Resilio Agent automatically during your next login.
Registering Resilio Agent as LaunchAgent will force OS X to load it when you login. Also, OS X will automatically relaunch Agent should it exit ungracefully.
Follow the steps below to run Resilio Agent as LaunchAgent:
- Mount the Resilio-Connect-Agent.dmg and drag the Resilio Connect Agent.app into
/Applications
folder -
Get rid of all extended attributes attached to the Application by OS X with command
xattr -rc /Applications/Resilio\ Connect\ Agent.app/
-
Download the com.resilio.agent.plist file and copy it to
/Library/LaunchAgents
folder. This action requires admin privileges. - Get the sync.conf file you got on Management Console and drop it to
~/Library/Application Support/Resilio Connect Agent
folder (create “Resilio Connect Agent” if it does not exist, all letters case sensitive). - Open terminal and run the command:
launchctl load /Library/LaunchAgents/com.resilio.agent.plist
Agent will run under current user account only when current user logged in.
If you need to start and stop Agent this should be performed with terminal commands:
sudo launchctl unload -w /Library/LaunchAgents/com.resilio.agent.plist
sudo launchctl load -w /Library/LaunchAgents/com.resilio.agent.plist
No Agent UI
Agent UI is not available when you run it as LaunchDaemon
Registering Resilio Agent as LaunchDaemon will force OS X to load it when system boots up. Resilio Agent will keep running and delivering data even when no user is yet logged in. OS X will also keep track of Agent's status and restart it should it exit ungracefully or get terminated.
Follow the steps below to run Resilio Agent as LaunchDaemon:
- Mount the Resilio-Connect-Agent.dmg and drag the Resilio Connect Agent.app into
/Applications
folder -
Get rid of all extended attributes attached to the Application by OS X with command
xattr -rc /Applications/Resilio\ Connect\ Agent.app/
-
Download the com.resilio.agentdaemon.plist file and copy it to
/Library/LaunchDaemons
folder. This action requires admin privileges.
!!! Important !!! Ensure that the root user owns the .plist file at the end, otherwise, launchctl will not load it and report error 5. -
Generate sync.conf file on your Management Console and ensure to disable Agent UI there.
- Get the sync.conf file you got on Management Console and drop it to
/var/root/Library/Application Support/Resilio Connect Agent
folder (create “Resilio Connect Agent” if it does not exist, all letters case sensitive). -
Launch the daemon with command
launchctl load -w /Library/LaunchDaemons/com.resilio.agentdaemon.plist
Daemon loads automatically with OS even when no users logged in. If you need to start it or stop use the terminal commands:
sudo launchctl unload -w /Library/LaunchDaemons/com.resilio.agentdaemon.plist
sudo launchctl load -w /Library/LaunchDaemons/com.resilio.agentdaemon.plist
No Agent UI
Agent UI is not available when you run it as LaunchDaemon
Note
- In the
com.resilio.agentdaemon.plist
file, there is a storage folder path specified in order to prevent a storage folder from being created in a temporary folder when an agent starts under the root user account. - Also, a storage folder path can be specified in another way using sync.conf file in which the line "storage_path": "/path/to/new/storage" should be added. In this case, this path will have a priority over the path specified in com.resilio.agentdaemon.plist file. It is preferable to have one path in com.resilio.agentdaemon.plist file or in sync.conf file only, to avoid any path conflict in the future and for easier troubleshooting.
- If daemon doesn't start at boot, on some macOS versions, it can be caused by the enabled FileVault encryption program.