xQuartz is an open-source X windowing system for macOS. I managed to run x2vnc on my mac:

  1. Install xQuartz.
  2. Download x2vnc.
  3. Within the x2vnc directory, run ./configure
  4. Edit the Makefile to include X11 (sorry I don't know the more elegant way to do this)

    • On line 7, add -I/opt/X11/include making the full line INCLUDES = -I/opt/X11/include -I. -DVERSION=\"$(VERSION)\"
    • On line 16, add -L/opt/X11/lib making the full line LDLIBS=-L/opt/X11/lib -lX11 -lm

      1. make and sudo make install