What is X11 Forwarding?
X11 Forwarding is what gives you the ability to run GUIs from a server on your own local machine (neat, huh?). For example, you can run Emacs from homework.eecs.tufts.edu from the comfort of your dorm.
Nov 13, 2009 Apple X11 for Mac OS X offers a complete X Window System implementation for running X11-based applications on Mac OS X. Based on the de facto-standard for X11, the open source XFree86 project, X11 for Mac OS X is compatible, fast and fully integrated with Mac OS X. It includes the full X11R6.6 technology including a window server, libraries. This will open X11 (or XQuartz), and you can run GUI programs by typing their name in the command line (sometimes, you access the GUI by adding an x before the name of the program, for example, the command line version of Maple is maple, but you can get the GUI by typing xmaple. Active Oldest Votes. You need to compile it as. Gcc test.c -I /opt/X11/include -L /opt/X11/lib. And then before running it. Export DISPLAY=:0. Improve this answer. X11 Forwarding in Linux/Mac OS X – For Macs, your best option is to download xQuartz from xQuartz.org. This is free software which will allow you to forward X11 on a Mac. Download the xQuartz DMG, open it, and follow the installation instructions.
Mac X11 Server
How do I use X11?
Simple! All operating systems have a quick process to setup X11 Forwarding. Please see below for specific instructions based on operating system.
X11 Forwarding in Linux/Mac OS X
– For Macs, your best option is to download xQuartz from xQuartz.org. This is free software which will allow you to forward X11 on a Mac.
- Download the xQuartz DMG, open it, and follow the installation instructions.
- Run xQuartz from the Applications folder.
– For Linux, depending on your distribution, there may be no pre-requisites.
Connecting With X11 through SSH
- Connect to your favorite EECS server using ssh, but remember to tell it to forward X by adding the “-X” parameter.
- Example: ssh –X [username]@homework.eecs.tufts.edu
- To test to make sure X11 is working properly, run “xeyes” and a simple GUI should appear on the screen.
- That’s it! Any other application (Emacs, Matlab, etc) that you’d like to run the GUI for, simply start the program and a window will appear.
X11 Forwarding in Windows with MobaXterm
- We recommend using MobaXterm for all your Windows X11 Forwarding needs.
- Simply download the installer, or run the portable edition, onto your computer.
- Follow all setup defaults for the installation.
- Run MobaXterm and use the Start local terminal button to begin a session.
- SSH to an EECS server as you normally would, but be sure to specify the -Y option. For Example:
- ssh -Y [username]@[servername].eecs.tufts.edu
- You’re now good to run GUI-based applications over ssh!
X11 Forwarding in Windows with PUTTY/Xming
- Xming is a lightweight and reliable X11 forwarding utility that can be used in conjuncture with Putty.
- Launch Xming: A small program will appear in the taskbar; keep this running for the duration of the session.
- Launch PuTTy, an SSH (Secure SHell) client: Start->Programs->PuTTy->PuTTy.
- In the left-hand menu, expand “SSH”, open the “X11” menu, and check “Enable X11 Forwarding.” Do not forget this step!
- Go back to the “Session” menu, and under “Host Name” type [email protected], then press Open.
- If a security alert pops up, press yes, then type your password into the open shell.
- You’re in Linux! Everything, such as “emacs myfile &”, will work just like a Linux lab machine.
If you want to ssh to another server during your session but want to keep X11 forwarding enabled, you must use the command “ssh -Y servername”.
X11 Forwarding in Windows with Cygwin/X
There are some cases in which Putty simply does not have enough functionality, and a more robust SSH/X11 client is necessary. In these cases, Windows users are best off using Cygwin. While Cygwin is extremely powerful and versatile, it can be a little overwhelming or confusing to setup and use your first time. The steps below will walk you through installing and running X11 Forwarding with Cygwin.
X11 Programs For Mac Download
- Go to www.cygwin.com and download the latest version.
- Run the setup.exe that you downloaded.
- Select “Install From Internet” as your download source.
- Leave the ‘Root Directory’ as default.
- Choose where you want your package files installed.
- Leave “Use System Proxy Settings” selected.
- Select any Download site, though the top one will be fine.
- Leave the default packages selected and change the View to Full.
- Use the Search box to search for openssh.
- Left-Click openssh: The OpenSSH server and client programs to set it to install the latest version. You can see that the New column has changed from Skip to the current version.
- Use the search box once again to search for xinit.
- Left-Click xinit: X Org X server launcher so that it switches from Skip to the current version.
- Press next to Continue and review.
- Note towards the bottom all the xorg packages which will also be installed. These are all necessary.
- Press Next to install everything (this may take a few minutes).
- Once installed, Open Cygwin to be presented with a terminal window.
- Run startx to open a new X11-enabled terminal window.
- In the new window, connect to the computer you would like to by using ssh -Y [username]@[hostname] – The “-Y” is required.
- Once connected, you’ll be able to run any X-based gui applications in your Cygwin window.
Locating or Installing X11
Mac OS X versions 10.5 through 10.7 include a pre-installed version of X11. Look for it in Applications->Utilities.
X11 Programs For Mac Software
If you have Mac OS X 10.8 (Mountain Lion), you will need to download X11 from the XQuartz project, and install it following the on-screen instructions after opening XQuartz-2.x.dmg and double-clicking XQuartz.pkg.
- Open the X11 application, located in the Utilities folder in your Applications folder.
- An xterm window will open automatically when you start X11. In this window, you will type one of two commands, depending on the version of Mac OS X that you are using. (If you don’t know which version you are using, you can figure it out by going to the Apple Menu and selecting “About this Mac”.)
- If you are using Mac OS X 10.4.0 or higher, the command to enter is
ssh -Y [email protected] (substitute your own BU login name for yourlogin and substitute acs for another machine, if applicable).
- If you are using Mac OS X 10.3.0 – 10.3.9, the command to enter is
ssh -X [email protected] (substitute your own BU login name for yourlogin and substitute acs for another machine, if applicable).
- If you are using Mac OS X 10.4.0 or higher, the command to enter is
- Type your Kerberos password when prompted.
- Now you can launch X Windows applications. To run SAS, for example, type
sas & (the ‘&’ puts it in the background so that you can type other commands in your xterm window if you need to).
- When you’re done, quit out of any X applications you were running. Then, to exit the X11 program itself, go to the X11 menu and choose Quit X11.