Urania

A blog named for the muse of Astronomy containing musings by an astronomer

HINTS: X11 on MacOS X

Posted on August 01, 2007 by Juan

On the Mac, X11 is part of the optional install. To quote Apple’s X11 Developer Note on Installing and Configuring X11 Applications on MacOS X on the Mac:

X11 is available as an optional install on the […] Mac OS X v10.4 Tiger install disks. Run the Installer, select the X11 option, and follow the instructions.

Once you have installed X11, you can launch X11 by going to the /Applications/Utilities/ directory and double clicking X11.app (this may display in the Finder as “X11” depending on your settings for showing File Extensions). And now some hints for better X11 usage (these are not in any particular order):

  1. If you are an astronomer, you probably use a lot of programs like IRAF, AIPS, or XEphemthat need X11. So it probably makes a lot of sense to set it up so that X11 automatically launches when you login. To do this:
    • Open your “Accounts” preference pane in the System Preferences.
    • Choose the “Login Items” tab within the Accounts pane and then you will see a list of login items (possibly empty).
    • You can add X11 to this list by pressing “+” at the bottom of the list of login items. This will bring up a dialog to select the file, work your way to the /Applications/Utilities/ directory and select X11 and you are done. NOTE: On MacOS X Tiger, there is no ability to control the order in which items are launched, so its position on the list is somewhat meaningless.
  2. There are many hidden preferences in X11 just like in many Mac Applications. You can see a list of the hidden (and not hidden) preferences using the command line tool defaults. To see the available X11 preferences, type:
    defaults read com.apple.x11
    
    In addition to “reading” the preferences, you can write to them. From the command line you can type:

    • defaults write com.apple.x11 no_quit_alert true

      This allows X11 to quit without an alert box. Useful if you find it irritating like I do that X11 will prevent me from logging out or the computer from restarting due to that dialog box. However, this does mean you can accidentally quit X11.app pretty easily if you hit cmd-Q at the wrong time.

    • defaults write com.apple.x11 wm_ffm true

      Allows which X11 window is selected to follow the mouse, which is the way X11 behaves under most *nix systems by default.

    • defaults write com.apple.x11 wm_click_through -bool true

      This activates click_thorough events in the Quartz window manager, which allows clicks to pinned windows, another behavior common to *nix X11 installations.

  3. On the Mac X11 launches the quartz-wm Window Manager and while you can run any other window manager of your choosing, I like it. However, if you modify your ~/.xinitrc file, you can control which window manager is launched. If you don’t have a ~/.xinitrc file, copy the default one:
    cp /private/etc/X11/xinit/xinitrc ~/.xinitc
    
    and then manipulate it with any text editor.

  4. You can launch an X11 application from the Terminal directly if you have set the DISPLAY environmental variable properly or by using the open-x11 command, for example:
    xclock &
    

    will launch the xclock in the background if I have already set the >DISPLAY variable.

    open-x11 /usr/X11R6/bin/xclock &
    
    will do the same without DISPLAY being set.

  5. BIG LAPTOP USER HINT: Because X11 on the Macintosh uses authentication to prevent connections from unauthorized sources to the X11 client, something interesting happens when you change IP address, you will discover you can’t use X11.app from the MacOS X Terminal until you quite and relaunch X11.app. This happens to me all the time on my laptop when I travel and the IP address changes. I recommend either using the Xterm as your terminal or just get used to restarting X11 if you have problems connecting to the terminal.
  6. You can run X11 remotely on your Mac, if you can ssh into your Mac, then just use

    ssh -Y youraccount@yourcomputer.com

    the -Y flag should allow you to run X11 remotely as long as X11.app is running on your machine before the connection is made. If your ssh on the remote machine doesn’t support X11 connections and you have admin access, you can edit the file /etc/sshd_config on the remote machine and make sure X11 Forwarding is turned on by looking for the following lines and making sure they are uncommented and that all “no”’s are set to “yes”:

    X11Forwarding yes<br />X11DisplayOffset 10<br />X11UseLocalhost yes
    
  7. The X11 Dock icon on the Mac can let you select specific X11 windows when X11 apps are running.X11 Menu
  8. Tektronix emulation in xterm is broken under MacOS X (at least in Tiger). To get it functional again, see my previous posting about this.

And that is it for the hints for now.

Leave a Reply


  • Translate

  • Astro Pic o' the Day

  • Archives

  • Admin



↑ Top