X
3973

How to fix hanging or freezing IDL graphics windows on MacOS

PROBLEM:

You may experience a persistent issue on MacOS in which spawning any IDL graphics windows will freeze or hang IDL, with the entire program becoming unresponsive.

This can happen in both IDLDE and IDL Command Line. It is most common on MacOS 10.15+ versions.

SOLUTION (PART ONE):

Most of the time, this issue is related to XQuartz. The following steps should be taken to try to resolve the issue:

  1. Install the latest version of XQuartz. The developers of XQuartz tend to keep it up-to-date to work with the latest version of MacOS. Your first step should be to make sure you have the latest (non-beta) version installed from XQuartz.org. Once the installation completes, reboot your computer to have the changes take full effect.
  2. Confirm that XQuartz has “Full Disk Access” permissions. Go to Apple Logo > System Preferences > Security & Privacy > Privacy > Full Disk Access. In this area, make sure that the boxes next to “launchd_startx” and “XQuartz” are both checked (see photo below). You may need to first click the lock icon in the bottom left and enter your password to be able to make these selections.


     
  3. Try a simple graphic in IDL. From a fresh IDL session, enter the following command in the IDL Console:

    p = plot(/test)

    If the graphics window comes up with a plot of a sine wave, the issue is resolved.

 

SOLUTION (PART TWO):

If still experiencing the hanging plot and session problem, you may also need to verify that a DISPLAY variable is set in your session. Do the following:

  1. Open a fresh Apple terminal (not an XQuartz terminal!)
  2. Set a fresh DISPLAY variable. Use this command:

    export DISPLAY=:0.0

     
  3. Then launch IDL or IDLDE from the Apple terminal.

    idl   or    idlde

     
  4. Try a simple graphic in IDL. Enter the following command in the IDL Console:

    p = plot(/test)

    If the graphics window comes up with a plot of a sine wave, the issue is resolved. If this fixed the issue, you may want to permanently add that DISPLAY definition to your ~/.bash_profile file to fix the problem fully moving forward.
  5.  

WORKAROUND:

If the issue still lingers despite the troubleshooting steps provided already, you can instead use a simple work-around to get IDL graphics running again.

Basically, just launch IDL or IDLDE from a XQuartz terminal instead of an Apple terminal. To do this, follow these steps:

  1. Double click the XQuartz logo to launch it.
  2. Open a new XQuartz terminal. In the dropdown at the top of the screen, go to Applications > Terminal. A new window will open titled “xterm”.
  3. Launch IDL or IDLDE from this new terminal. Depending if the aliases are established in this environment, you may need to provide the full path to the IDL launch script. For example:

    /Applications/harris/idl88/bin/idl

     
  4. Try a simple graphic in IDL. Enter the following command in the IDL Console:

    p = plot(/test)

    The sine wave plot should pop up normally in this instance. If you make sure to always launch IDL from an XQuartz terminal the issue will not occur. You may still see the issue if launching IDL from the icon or from Apple terminal.

 

Created by BCNA 6/10/21, Reviewed by MM 6/11/21