First go to https://xquartz.macosforge.org/trac to get the release version of X11. After you finish the installment, you should do the following steps to config your X11 on your Mac.
- Launch the Terminal application (found in your Utilities folder).
- Start by making a copy of the
/etc/sshd_config
file which is the configuration file for the SSH daemon.sudo cp /etc/sshd_config sshd_config.orig
The
sudo
command will allow you to execute thecp
(copy) command with root permissions giving you full read/write access to the filesystem. You will need an administrator password. Enter it when prompted. - Edit the original file we just made a backup copy of using your preferred text editor. Be sure to use a plain text editor such as BBEdit, pico or vi in order to preserve the integrity of the file. In this case, using pico.
sudo vi /etc/sshd_config
- The contents of the
sshd_config
file should now be visible in your Terminal window. Locate that line that reads#X11Forwarding no
and change it to remove the octothorp character at the beginning of the line to activate it. We also need to change the line to replaceno
withyes
.The final line should look like:
X11Forwarding yes
You can check if the step 4 with the command:
grep X11Forwarding /etc/sshd_config
make sure you have seen this:X11Forwarding yes in your termal.
- grep X11Forwarding /etc/sshd_config
-
Connecting To Remote Servers
Now that we have X11 configured, if you have a second computer available you can test a remote connection.
- Open X11 in your Utilities folder. A window that looks deceptively like the Terminal will open.
- In the new xterm window, use the following command to remotely login to a second computer (Mac OS X, Linux or other *nix):
ssh -X [USERNAME]
@[IPADDRESS]. - Type
exit
in the xterm window when you are done. This will disconnect you from the remote server.