2

Here's my current setup:

  • Host: MacOS
  • VM: Linux (Ubuntu 18.04)
  • Hypervisor: Parallels 14
  • Host terminal emulator: iTerm2
  • Shell: Bash

I do all of my development in my Linux VM (I ssh into the VM, being terminal-only works great for me in my dev environment), and I'm a heavy user of tmux. With that being said, tmux isn't great for doing the typical mouse-drag copy/paste of text.

In the past, I've used xclip (xclip -sel c) to dump things on the clipboard. In this case, though, I'd like to dump text from my Linux VM onto the MacOS clipboard. Doing $ echo hello world | xclip -sel c gives me an error of:

Error: Can't open display: (null)

And then if I try to do something like $ echo hello world | DISPLAY=:0 xclip -sel c I get another error:

No protocol specified

Error: Can't open display: :0

Any thoughts on how to get this working? Thank you in advance!

1 Answer 1

2

The way X programs work is that they look for a variable called DISPLAY, which contains the identity of the X server it should connect to, and then connect to this X server.

There is no X server running on your VM. However, MacOS can run an X server (calls XQuartz), and you can make ssh forward X connections to this server (either with ssh -X or with the configuration file, see the man pages). This will automatically set DISPLAY (check by echo $DISPLAY), and establish a "fake X server endpoint" on the VM which can be used by xclip etc.

You may have to manually start XQuartz on MacOS, I never tried X forwarding from there.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.