You can set up GADS provider to run as a launchd service on macOS. This ensures the provider starts automatically on boot and restarts if it crashes.
- Move the
gadsbinary to/usr/local/bin/gads - Ensure the binary is executable:
sudo chmod +x /usr/local/bin/gads - Grant Full Disk Access to
/usr/local/bin/gadsin System Settings > Privacy & Security. - Important: If providing only iOS devices on an Intel Mac, it is recommended to uninstall
adb(Android Debug Bridge) to prevent potential kernel panics and USB instability.
Create a new file at /Library/LaunchDaemons/com.gads.provider.plist:
sudo nano /Library/LaunchDaemons/com.gads.provider.plist
Paste the following configuration, adjusting the values for your environment:
<?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](http://www.apple.com/DTDs/PropertyList-1.0.dtd)">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.gads.provider</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/gads</string>
<string>provider</string>
<string>--hub</string>
<string>http://___.___.___.___:PORT</string>
<string>--mongo-db</string>
<string>___.___.___.___:27017</string>
<string>--nickname</string>
<string>YOUR-PROVIDER-NAME</string>
<string>--log-level</string>
<string>info</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/var/log/gads-provider.log</string>
<key>StandardErrorPath</key>
<string>/var/log/gads-provider-err.log</string>
<key>WorkingDirectory</key>
<string>/Users/admin/gads</string>
</dict>
</plist>To activate the service, you must set the correct system permissions and then bootstrap it into the system domain.
# Set the correct ownership (root is required for LaunchDaemons)
sudo chown root:wheel /Library/LaunchDaemons/com.gads.provider.plist
# Load and start the service
sudo launchctl bootstrap system /Library/LaunchDaemons/com.gads.provider.plistYou can monitor and control the provider using standard macOS launchctl commands.
To verify the service is running, look for a PID (Process ID) in the first column. A 0 in the second column indicates a clean run, while a non-zero number indicates the last exit code.
sudo launchctl list | grep gadsThe provider outputs all activity to the logs defined in the .plist. This is the best way to troubleshoot device connection issues.
# Follow the live log
tail -f /var/log/gads-provider.log
# Check for startup errors
tail -f /var/log/gads-provider-err.logTo stop the provider from running in the background:
sudo launchctl bootout system /Library/LaunchDaemons/com.gads.provider.plistTo apply changes made to the .plist file, run the bootout command above followed by the bootstrap command from the Load the service section.
Input/Output Error: If bootstrap fails with Error 5, it usually means the service is already loaded or the file has a syntax error. Try a full reboot of the Mac. Permission Denied: Ensure the binary has Full Disk Access and that you used sudo for all launchctl commands. Device Offline: If the provider is running but devices are offline, check the logs to ensure the provider can reach the Hub's MongoDB port (27017).