Forwarding an X11 Session through SSH

To get your X11 windows to open when you're logged in remotely:

edit (on the remote Mac) /etc/sshd_config as sudo; make sure a line that says "X11Forwarding yes" is uncommented, like this:

#AllowTcpForwarding yes
#GatewayPorts no
X11Forwarding yes
#X11DisplayOffset 10
Then restart sshd on the Mac. If you're at the console, you can do this by unchecking then rechecking the Sharing --> Services --> Remote Login button in System Preferences. There is *supposed* to be a command line way to do it which supposedly works remotely:
$ sudo SystemStarter -v restart SSH
but when I do this the console just gives me:
SystemStarter[23616]: Unknown service: SSH
What *does* work is if you just ps -A | grep -i ssh to get the process ID
$ sudo ps -A | grep -i ssh
23450  ??  S      0:00.12 /usr/sbin/sshd -i
23455  ??  S      0:00.03 /usr/sbin/sshd -i
23649  p8  S+     0:00.00 grep -i ssh
and then use "kill" on the sshd PID
$ sudo kill 23450
sshd then restarts automatically, and if you edited sshd_config in the meantime it restarts with the new settings. Yay X11!

Update: Getting Remote X Windows to Display On Your Mac

For some reason I only had to do this for Mozilla, which was giving me errors like this:
Gdk-ERROR **: BadDrawable (invalid Pixmap or Window parameter)
$ sudo emacs -nw /etc/ssh_config
Password:
Where it says
#   ForwardX11 no
change it to
#   ForwardX11 yes
Also, use the -Y switch on ssh (instead of -X).
Return to NewMacIntel.