in Cross-platform, Utilities

Along with my recent solution to the laborious ways of typing accents on Windows, I regularly encounter another problem. At my desk, I have three monitors, two computer towers, a ThinkPad and a MacBook Pro, all running different operating systems. After all of that is put together, I only have enough space for one keyboard and mouse set. Some of you might already be aware of the paid, partly open source software Synergy, but there are various features of the 2.0 version that I don’t care for. That’s where Barrier, an open-source fork of Synergy Core, comes in.

What is Synergy, and What is Barrier?

Synergy is a part-open source, part-proprietary application that allows multiple computers to share a single keyboard and mouse set. This allows you to have multiple computers attached to separate monitors, all of which can be worked on with only one set of peripherals. Synergy works by running a server on the computer that the keyboard and mouse are connected to. This server then talks to clients that are installed on the other computers via SSH.

Barrier running on my Windows computer.

Barrier running on my Windows computer.

Barrier is a fork of the open source component of Synergy 1.9 that aims to focus on the basic Synergy functionality prior to the release of 2.0. Setting aside my issues with the license they must use, it does exactly what I expect of Synergy; it lets me use one keyboard and one mouse with all of the computers I have at my desk.

Installing Barrier for the First Time

Barrier is incredibly easy to install, with pre-compiled binaries provided for Windows, macOS, FreeBSD, and GNU/Linux. There is also an Arch Linux package available via the AUR.

Note: Barrier currently has a bug relating to the SSL library it uses. You may need to use the 2.0.0 release for now. At the time of this post, the most recent release is 2.1.1, so if there is a version newer than that, the bug may have been resolved.

On Windows and macOS, we can install Barrier by downloading and running the binary installer provided at the link above. On FreeBSD, download the pre-packaged binaries and extract them to the appropriate directory; the developers are working on getting Barrier included in the ports tree. GNU/Linux users will have to consult their relevant distribution’s documentation for installation instructions.

Windows users may need to uninstall Microsoft’s Mouse without Borders to get Barrier to work. If any part of the process outlined below fails, check to see if it is installed and remove it.

Let’s start by installing it on your server – the system that has the keyboard and mouse physically connected to it. Once it’s installed, go ahead and run it and you will be greeted by the first time configuration setup.

Configuring and Using Barrier

When configuring on your server you will be presented with a range of options. Everything you see should be self-explanatory, thanks to Barrier’s ridiculously relaxed setup and well-named options. Not many, if any, of these will need changing, but you should check through all of them to see if there are any settings you want to try out. You can reconfigure Barrier at any time by clicking the “Configure Server” button.

Once you have Barrier installed on your server, it’s time to install it on your clients. This time, there isn’t much configuration to do. Simply tell Barrier that this system will be a client, and that’s it. If Barrier picks up a server on your network, it can configure itself to use it. Otherwise, enter the server’s IP into the UI, as in the image below.

My MacBook's Barrier client, displaying it's status and connection configuration.

My MacBook’s Barrier client, displaying it’s status and connection configuration.

Telling Barrier About Your Clients

Once you have Barrier installed on both the server and all of the clients, return to the server configuration screen via the button on the server’s Barrier user interface. On the “Screens and links” pane, we can configure Barrier’s layout. You should see a grid of squares, 5 columns by 3 rows, with a monitor in the middle square that has the name of your server.

Start Barrier on the server and all of your clients if you haven’t already by clicking the “Start” button in each Barrier instance. If you have monitors for all of your clients, then Barrier is ready to use. Your clients should be configured automatically. Drag the monitors around the grid until they’re all laid out in a way that you find logical, then apply your configuration.

If you don’t have monitors for all of your clients, use the image of the monitor in the upper right-hand corner to drag monitors onto the grid. You’ll need one for every client, and it’s a good idea to rename them from “Unnamed” to the name of the client. Drag the monitors and apply the configuration as stated above.

You should have a “Screens and links” grid similar to the one below, depending on how many clients you have and how they are arranged.

My Barrier server configuration. Left to right: curie (ThinkPad, FreeBSD), glory (home server, FreeBSD), cassidy (Windows PC, the Barrier server), veronica (MacBook Pro, macOS).

My Barrier server configuration. Left to right: curie (ThinkPad, FreeBSD), glory (home server, FreeBSD), cassidy (Windows PC, the Barrier server), and veronica (MacBook Pro, macOS).

Concluding Using Barrier

And that’s it! Now you can use a single keyboard and mouse set connected to just one PC to navigate around several computers on your local network at once.

Go ahead and push your mouse to the edge of your server’s screen and watch it glide on over to your client. Type away and watch all of your input appear on the client as if your keyboard was connected to it directly. Now you can ditch that ageing VGA KVM switch once and for all.

Based on reader feedback, I should clarify that Barrier requires that every computer has a monitor. It’s ideal for single-desk, multi-computer workstations. It isn’t designed to be used where multiple monitors are not possible.

I’ve had Barrier running for over a year now, and I expect it to serve me well far into the future.

As always, drop a comment below or join the Rauchland Discord server if you have any comments or questions

If you enjoy my blog or find it useful, please consider becoming a patron on Patreon to help me keep my site live and create more content!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

22 Comments

        • It looks like you have to built it from source, unfortunately. The Barrier Wiki provides the following instructions for this on Debian/Ubuntu derivatives:

          sudo apt update && sudo apt upgrade
          sudo apt install git cmake make xorg-dev g++ libcurl4-openssl-dev \
                           libavahi-compat-libdnssd-dev libssl-dev libx11-dev \
                           libqt4-dev qtbase5-dev
          git clone git@github.com:debauchee/barrier.git
          cd barrier
          ./clean_build.sh
          cd build
          sudo make install  # installs to /usr/local/ 

          Run these commands in your terminal and see if it installs.

          • I cannot reply to Humberto directly so I’ll do it here – you need to have a working github account in order to do the git clone. In order for the command to work as is you would have to configure a SSH key in your github account. If you want to avoid this step just do:

            git clone https://github.com/debauchee/barrier.git

            and use your credentials there.
            After you’re done with the steps that are already described be sure to do:

            cd build
            sudo make install

            and you’re done. It should be available for you as a regular application now. I just did this with elementary os 5 (ubuntu 18.04) and it’s working.

  1. Great article. Thanks for the pointer on the current SSL bug.

    Getting Mac, Windows, and Xubuntu all to talk to each other is a bit tricky. I have it running, but can’t retrace my steps.

    Humberto there is a .deb of 2.1.2 available at https://pkgs.org/download/barrier , but I can’t speak to its trustworthiness or reliability.
    I thought I had a .deb of an older version, but I don’t know now.

    • I haven’t tested this as I log in via my Mac, but this might work.

      Create a file somewhere in your home directory with the following contents:

      #!/bin/sh
      /Applications/Barrier.app/Contents/MacOS/barrierc -f

      Then chmod +x the file to make it executable.

      Create another file in ~/Library/LaunchAgents with the file extension .plist and the following content:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
      <plist version="1.0">
          <dict>
              <key>Label</key>
              <string>name-of-your-plist</string>
              <key>Program</key>
              <string>location-of-your-sh-script.sh</string>
              <key>KeepAlive</key>
              <true/>
          </dict>
      </plist>

      Finally, in a Terminal window, enter sudo launchctl load -w /Library/LaunchDaemons/name-of-your-plist.plist

      Hopefully, that should start Barrier before you log in on your next boot.

    • Could you share the last few lines of the log from when you attempt to connect? It could reveal the problem. You can access the log from the “Barrier” menu or by pressing F2 when the window is in focus.

      • Hello Rauchmann, thanks for replying to my comment. After posting that comment, and a few more hours trying to get Barrier to work I gave up. Since this is a brand new PC I decided to give Synergy one last try so I located 1.8.8 stable for Windows 10, although it failed on my last old PC. However, this time it just worked. Not sure if it was how old my last PC was or what, but it worked perfectly this time around. So then I decided to install Synergy 1.8.8 for Ubuntu 18.04, and sure enough it just worked. Didn’t have to fiddle for hours trying to make it work.

        So, now that I have Synergy working, and have uninstalled Barrier, I am wondering if you still would like me to try getting Barrier working or not? I am willing to go further if it helps someone understand the problem. But for now I have it working mostly.

        However, when Ubuntu launches I am getting a error message popup stating that “System tray is unavailable, don’t close your window”. So, I have to remove the logitech wireless dongle from my new PC and place it on my Ubuntu machine just to hit the OK button, then move it back to my main PC (server) and go from there. After hitting that OK button synergy then immediately starts and all functions OK. I still have Barrier installed on the Ubuntu machine because I could not figure out how to uninstall it.

        Anyway, would you like me to install Barrier again on Windows 10 and see if we can figure out why it’s not working? Thanks

        • OK, I’m back. Just wanted to say I gave Barrier another chance. Also decided to install a fresh Mint 19.1 xfce over Ubuntu gnome. Spent hours but Barrier is clearly broken, even after getting around the first issue the second issue is that the cursor completely disappears once it changes screens. Barrier is about as broken as it can get on Ubuntu, not one but two fresh installs. I went back to Synergy a second time today and it just works instantly.

          Thanks again, but no need to bother with my previous requests but I highly thank you for your guide and the help your giving to users who comment here. But I’m going to stick to this Synergy until something forces me to switch.

          Best Regards
          Rod

          • Thanks for keeping me in the loop. I’m sorry to hear that Barrier didn’t work for you again. I’m wondering if this is an Ubuntu specific issue; I will have to spin up an Ubuntu machine and do some testing.

            I’m glad Synergy is working for you, at least. That is good news. Symless make a great product, and Barrier wouldn’t be here if it weren’t for them.

            Do be sure to check in if your situation changes.

        • everytime I had problems with synergy connection it was a firewall issue..
          for example kaspersky total protection blocked almost all connections and had to be selected do not block connections on quit right away” feature on..

          then I realised that in win10 unknown network is accepted to be a public network and by default it was blocked and had to turn that off again for unknown network clients to be able to connect to server etc.

  2. Nice article!

    I am trying to get Barrier work between macOS and Windows. Unfortunately without success.
    My MBP is the server and a desktop PC is the client.
    They are both connected to the same network (MBP via WiFi, Desktop PC via ethernet).

    Error log on the server says: 2019-05-17 13:14:19.164 barriers[822:9330] pid(822)/euid(501) is calling TIS/TSM in non-main thread environment, ERROR : This is NOT allowed. Please call TIS/TSM in main thread!!!

    Error log on the client says: Warning: failed to connect to server: Connection was refused.

    I’ve looked through the issues on github, but couldn’t find the solution.
    I’ve followed the instructions in this article and on github.
    I’ve made sure to allow the application in Windows Firewall.
    I used to use Mouse without Borders and uninstalled it and restarted the PC.

    Not sure what else I can do.

    Does anyone have successfully running it between macOS and Windows?
    Has anyone been able to resolve any of those error messages?

    Big thanks for any suggestions in advance.

    Kind regards
    Rasti

        • Try allowing both barrier and barriers to communicate through the firewall on both systems. Ensure that both public and private are enabled, as this seems to have an effect. If this doesn’t work, try temporarily disabling the firewall; if they connect when the firewall is disabled, that is the problem. You can reenable the firewall after the connection is made and it should stay active.

          If it still doesn’t work, run Barrier and attempt to connect. Once it fails, or after a few seconds, stop Barrier. Use the “Barrier -> Show Logs” menu items to open the logs, and either copy the last few lines of the log into a comment, or copy the entire log into a Pastebin entry and share the link. Hopefully, the log will reveal what is preventing them from connecting.