mirror of
https://github.com/debauchee/barrier.git
synced 2026-05-15 14:16:02 -06:00
[GH-ISSUE #492] run client at system startup on macOS #382
Labels
No labels
HiDPI
bounty
bsd/freebsd
bsd/openbsd
bug
bug
build-infra
cantfix
critical
doc
duplicate
enhancement
fix-available
from git
from release
good first issue
help wanted
installer/package
invalid
linux
macOS
meta
needs testing
pull-request
query
question
regression
regression
v2.4.0
windows
wontfix
work-in-progress
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/barrier#382
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @puzne2000 on GitHub (Nov 15, 2019).
Original GitHub issue: https://github.com/debauchee/barrier/issues/492
Barrier Version
2.3.2
Other info
This is a feature request which doesn't necessarily require coding.
I would like to have a macOS computer run a barrier client, so that I will not have to connect it to a keyboard or mouse. So I want the client to start running at system startup, or else I need to first login, and only then Barrier starts... This should be doable, but I don't know the OS well enough to do it myself and I don't have the time to figure it out. Would be nice if someone could just write nice clear instructions for how to do it...
Thanks
@puzne2000 commented on GitHub (Nov 17, 2019):
update:
tried running at startup using launchctl.
-- I wrote a script to run barrierc, made it executable, and ran it: it ran well.
-- I made a plist as described here:
https://medium.com/@fahimhossain_16989/adding-startup-scripts-to-launch-daemon-on-mac-os-x-sierra-10-12-6-7e0318c74de1
and indeed it ran my script and barrier started running at system startup as root (I checked). However, when run in this form even though it kept running in the background, it didn't really work and I could not use the mouse from the server on the client.
any help would be welcome..
@rodneyrod commented on GitHub (Nov 18, 2019):
@puzne2000 Is it running as the system user? It may be looking for config in a different location or might not have permission to view the config in your home directory.
@schroederjulius commented on GitHub (Nov 23, 2019):
Could you please upload the script you used to run barrier?
@puzne2000 commented on GitHub (Nov 23, 2019):
Hi,
ok the long version is below. The short version is that it seems that it tried to access
/var/root/Library/Application Support/barrier/SSL/Fingerprints/TrustedServers.txt
in order to connect to the server, and it doesn't have permission for that.
And now for the long version: I ran a ps command (ps -x| grep barrier) while barrier was running, and copied the line with the barrier command to my script. The result was this:
#!/bin/sh
/Applications/Barrier.app/Contents/MacOS/barrierc -f --no-tray --debug INFO --name Flatty.local --enable-drag-drop --enable-crypto [192.168.0.174]:24800
Flatty.local is the bonjour name of the client (not that it matters), and the IP address is the local address of the server. I think I also tried to remove the -f, but I'm not sure.
As for the plist that I added to /Library/LauenchDeamons, it's file name is myBarrierLauencher.plist, and here it is:
Label myBarrierLauncher Program /Users/####/launchbarrier.sh KeepAliveabove I replaced my username with ####.
The owner of the plist is wheel, which I did with sudo chown. I then added the plist to the launch deamon via
sudo launchctl load -w /Library/LaunchDaemons/myBarrierLauncher.plist
after restarting the computer, barrier doesn't work. However, applying ps -efx |grep barrier yields
The time stamp matches the time when I restarted the comp. Finally, here's a dump from /var/log/system.log that I got by cat /var/log/system.log|grep Barrier
Nov 23 20:24:12 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): This service is defined to be constantly running and is inherently inefficient.
Nov 23 20:24:12 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48683]): Service exited with abnormal code: 134
Nov 23 20:24:12 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:24:22 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48688]): Service exited with abnormal code: 134
Nov 23 20:24:22 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:24:32 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48692]): Service exited with abnormal code: 134
Nov 23 20:24:32 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:24:42 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48695]): Service exited with abnormal code: 134
Nov 23 20:24:42 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:24:52 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48699]): Service exited with abnormal code: 134
Nov 23 20:24:52 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:25:02 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48703]): Service exited with abnormal code: 134
Nov 23 20:25:02 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:25:12 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48706]): Service exited with abnormal code: 134
Nov 23 20:25:12 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:25:23 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48709]): Service exited with abnormal code: 134
Nov 23 20:25:23 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:25:33 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48715]): Service exited with abnormal code: 134
Nov 23 20:25:33 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:25:43 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[48721]): Service exited with abnormal code: 134
Nov 23 20:25:43 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:25:53 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
Nov 23 20:25:53 Flatty Barrier 2.3.2-Release[48752]: [2019-11-23T20:25:53] ERROR: unable to connect to pasteboard, clipboard sharing disabled
Nov 23 20:25:53 Flatty Barrier 2.3.2-Release[48752]: [2019-11-23T20:25:53] NOTE: started client
Nov 23 20:25:53 Flatty Barrier 2.3.2-Release[48752]: [2019-11-23T20:25:53] NOTE: connecting to '192.168.0.174': 192.168.0.174:24800
Nov 23 20:25:53 Flatty Barrier 2.3.2-Release[48752]: [2019-11-23T20:25:53] NOTE: server fingerprint: ####
Nov 23 20:25:53 Flatty Barrier 2.3.2-Release[48752]: [2019-11-23T20:25:53] NOTE: trustedServersFilename: /var/root/Library/Application Support/barrier/SSL/Fingerprints/TrustedServers.txt
Nov 23 20:25:53 Flatty Barrier 2.3.2-Release[48752]: [2019-11-23T20:25:53] NOTE: Unable to open trustedServersFile: /var/root/Library/Application Support/barrier/SSL/Fingerprints/TrustedServers.txt
Nov 23 20:25:53 Flatty Barrier 2.3.2-Release[48752]: [2019-11-23T20:25:53] ERROR: failed to verify server certificate fingerprint
Nov 23 20:27:24 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher): Service only ran for 4 seconds. Pushing respawn out by 6 seconds.
Nov 23 20:27:24 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:24] ERROR: unable to connect to pasteboard, clipboard sharing disabled
Nov 23 20:27:24 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:24] NOTE: started client
Nov 23 20:27:24 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:24] NOTE: connecting to '192.168.0.174': 192.168.0.174:24800
Nov 23 20:27:25 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:25] WARNING: failed to connect to server: cannot connect socket: Network is unreachable
Nov 23 20:27:26 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:26] NOTE: connecting to '192.168.0.174': 192.168.0.174:24800
Nov 23 20:27:26 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:26] WARNING: failed to connect to server: cannot connect socket: Network is unreachable
Nov 23 20:27:27 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:27] NOTE: connecting to '192.168.0.174': 192.168.0.174:24800
Nov 23 20:27:27 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:27] WARNING: failed to connect to server: cannot connect socket: Network is unreachable
Nov 23 20:27:28 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:28] NOTE: connecting to '192.168.0.174': 192.168.0.174:24800
Nov 23 20:27:28 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:28] NOTE: server fingerprint: ####
Nov 23 20:27:28 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:28] NOTE: trustedServersFilename: /var/root/Library/Application Support/barrier/SSL/Fingerprints/TrustedServers.txt
Nov 23 20:27:28 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:28] NOTE: Unable to open trustedServersFile: /var/root/Library/Application Support/barrier/SSL/Fingerprints/TrustedServers.txt
Nov 23 20:27:28 Flatty Barrier 2.3.2-Release[340]: [2019-11-23T20:27:28] ERROR: failed to verify server certificate fingerprint
Nov 23 20:27:28 Flatty com.apple.xpc.launchd[1] (myBarrierLauncher[425]): Service exited with abnormal code: 134
where I have erased the actual server fingerprints and replaced with #### (at least I tried).
thanks,
@rodneyrod commented on GitHub (Nov 24, 2019):
Is it possible to login as root, then copy your config to /var/root/Library/Application Support/barrier/SSL/Fingerprints/TrustedServers.txt?
This is because it's not your user that will be running Barrier, but rather the service or root account attempting to run it prior to user login and those accounts will expect the configs to be in a specific location for those accounts.
@oristopo commented on GitHub (Nov 27, 2019):
@puzne2000 perhaps one problem is that /var/root/Library/Application Support/barrier/SSL/Fingerprints/TrustedServers.txt does not yet exist.
Attached zip includes barrierc-trust.sh, which will generate that file if run e.g.:
sudo barrierc-trust.sh [192.168.0.174]:24800
It is based on https://gist.github.com/dayne/e3a7f31f0624bf299faf9fadfe510322
adding quotes around paths for blank in ../Library/Application Support/..
With that file generated, macOS client works immediately by:
sudo launchctl load -w /Library/LaunchDaemons/com.github.debauchee.barrier.plist
..using the plist in attached zip, but fails during reboots:
(com.github.debauchee.barrier[610]): Service exited due to signal: Segmentation fault: 11 sent by exc handler[0]
I guess barrierc gets launched during reboot before mouse handling is ready..??
client.zip
@oristopo commented on GitHub (Nov 27, 2019):
Another clue:
After successful macOS client launch by:
sudo launchctl load -w /Library/LaunchDaemons/com.github.debauchee.barrier.plist
.. then logoff (but leave running) that client, server mouse cannot move cursor onto client screen.
Mouse cursor does move off server screen, and correct client function resumes after login,
so barrierc continued running on the client, but, unlike Windows client, macOS client does not support cursor movement while user not logged in.
@oristopo commented on GitHub (Nov 27, 2019):
When launched by root, server mouse works for
/Applications/Barrier.app/Contents/MacOS/barrierc
.. but keyboard does NOT.
A work-around:
Copy/paste does not work from Windows server to macOS client,
but works from client to server...
@github-actions[bot] commented on GitHub (Oct 1, 2020):
Is this issue still an issue for you? Please do comment and let us know! Alternatively, you may close the issue yourself if it is no longer an problem
@axelson commented on GitHub (Oct 2, 2020):
This is still relevant
@puzne2000 commented on GitHub (Oct 3, 2020):
Just letting you know that the comp I was using Barrier to control died, may he rest in peace. Didn't yet decide if to buy another one or to just buy a second screen for my current comp - if I get another comp I'll try the suggested mediations and report here...
@chrisrimple commented on GitHub (Apr 6, 2021):
Another vote for this feature. My config:
Both laptops use external monitors and are normally closed. Even with Barrier set to Open At Login (via Dock settings), the client doesn't receive mouse/keyboard until Login has been completed. Unfortunately, this means that I have to open up the Big Sur laptop, login, then close it up again.
FWIW, I had the same problem with ShareMouse.
@Revadike commented on GitHub (Aug 31, 2023):
Bump!
@Falcon-16 commented on GitHub (Dec 6, 2025):
Bump! Would like to get this implemented so I can control when a laptop boots and log in and do things remotely, rather than having to log in physically on the laptop first!
@nbolton commented on GitHub (Dec 7, 2025):
Barrier is no longer in development. Check out Deskflow (upstream) or Input Leap (fork).
https://github.com/deskflow/deskflow
https://github.com/input-leap/input-leap
If this is still an issue in those projects, we would appreciate a cross-post of this issue.