Jump to content
Get SynergyOpen a support ticket

Working: auto-start synergyc MacOS Monterey before login


Recommended Posts

bryanwrightscode

I saw several topics about wanting to launch the client (synergyc) on MacOS before the login screen just after booting. I am not sure if others have since found solutions but it seemed that there were issues with this after certain versions of MacOS.  My purpose posting this is just to let the forum know that I got this to work on Monterey at time of posting and can answer questions if anybody wants to know more.

Here is how I did it:

  • Run the server (I think it is synergys) on Windows. I use win10 and am using the GUI.
  • Write and make executable a shell script that starts the client and register it to be run by the globale launchd on the mac
    • My default shell is zsh
    • The executable script is saved to /Users/Shared/<myname>_scripts/synergyc.sh (name doesn't have to match)
    • The script launches a client and I pass the IP of the server as the only argument. The syntax is based on the synergy-core CLI documentation
    • #!/bin/zsh
      cd /Applications/Synergy.app/Contents/MacOS
      ./synergyc <SERVER_IP_ADDRESS>
    • Register the script as a launch daemon.  I used Lingon (requires license) but you could theoretically write the plist. Another option is LaunchControl (also paid). Lingon is just a GUI for managing plists but essentially it adds one with the correct keys/settings values to be picked up by the root level launchd. It is found at /Library/LaunchDaemons/ There is also a launchd for System separate from root at /System/LaunchDaemons/. The main key this adds is "RunAtLoad".  Because it is global root, the first bootup won't work unless you've already added your shell (for me zsh) to the list of apps in SysPrefs/Privacy/Accessibility.  You can do that now.  By trial and error after 1 boot I was prompted to do this.  Doint it before saves you having to switch your mouse/keyboard manually.
    • Below here is the full contents of the .plist after creating it in Lingon
    • <?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>EnvironmentVariables</key>
      	<dict>
      		<key>PATH</key>
      		<string>/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin</string>
      	</dict>
      	<key>Label</key>
      	<string>syngergyc</string>
      	<key>ProgramArguments</key>
      	<array>
      		<string>/Users/Shared/bwright_scripts/synergyc.sh</string>
      	</array>
      	<key>RunAtLoad</key>
      	<true/>
      </dict>
      </plist>

       

  • Restart your mac (client machine). It will boot to login page as normal (assuming you didn't turn on auto login).  After a few hundred milliseconds and moving cursor from the server machine to the screen for the client, the server logs that the client connection is established (log file/GUI logs list etc) and the mouse (and other peripherals) work.
  • That's it, login. Because my script uses the CLI and it is launced as daemon there's no GUI. It just works. The limitation is that the GUI isn't registered with the WindowServer and it kind of requires killing the existing Synergy process. So that's not ideal. 

 

This makes it possible to boot up on a whim and launch the client before needing keyboard/mouse. It addresses some previous forum posts and the synergy-core auto-start documentation suggesting that auto-starting at boot before login was not possible after certain MacOS versions unless you turned on auto -login (a major vulnerability at least in my case).  With the limitation about the GUI, users can try writing the script to perhaps launch the GUI I just don't know what CLI arguments would do that.

cheers and if this is old news oh well lol

Bryan

 

  • Like 1
Link to post
Share on other sites
bryanwrightscode

Also disclaimer use these steps at your own risk I claim no responsibility if you break your OS

Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...