Why doesn't (can't?) terminal support the x11 protocol?

It would be great to be able to x tunnel over ssh; why does one have to use XQuartz (etc) instead?


Solution 1:

The simple answer is: Terminal is a terminal emulator -- it's not an X11 server. It exists to provide a text-based communication end point between your Mac and other machines.

Terminal is no more an X11 server than gnome-terminal on Linux is or cmd on Windows is. Which is to say: it isn't an X11 server at all. You need to be running an X11 server on your local machine to be able to have tunneled, graphical, X11 applications draw their UIs on your Mac. This isn't actually different for Mac from something like Linux, it's just that Linux, by default, is always running an X11 server for drawing your desktop so it's handled a little more gracefully than it is on the Mac. You just have to open up your X11 server's permissions and ssh tunneling and X11 forwarding on a Linux desktop seem to work.

The XQuartz server you run on OS X simply gets you the missing X11 server you need on your OS X session to enable drawing the forwarded UI commands on your OS X desktop. This isn't something an Terminal application ever would, or ever should really, implement. It's not part of being a Terminal. It's a wholly separate thing.

I also want to address something you said in your question:

It would be great to be able to x tunnel over ssh

I'm assuming you mean "it would be great to do X11 forwarding from an ssh session started in Terminal.app to my running XQuartz server". You can do this!

When you use ssh in Terminal.app simply include the -X option to enable X forwarding and your Mac will start XQuartz automatically. No need to use the terminal app in XQuartz, which pretty much sucks.

You can also edit ~/.ssh/config and add:

ForwardX11 yes

to that file to enable X forwarding by default for all ssh sessions. You can even launch X programs on the remote machine in to the background like so:

ssh username@remoteserver -f -X xeyes

That works from Terminal.