Quick tips for customizing your IDL program search path

The IDL_PATH preference provides the initial value of the !PATH system variable, which determines the directories from which IDL searches for program and include files written in the IDL language (*.pro and application*.sav files).

Here are some tips on customizing your IDL program search path settings.

1.) The Default IDL Search Path

When defining a customized IDL program search path preference "IDL_PATH", it is recommended that you use the token:


to include the entire [IDL-directory]/lib directory tree, as well as the [IDL-directory]/examples directory tree, in addition to your custom search path.  

2.) Customizing your IDL_PATH preference via the IDL Workbench Preferences dialog (Windows, Linux and Mac OS X only)

The IDL_PATH preference can be changed via the IDL Workbench (idlde) Preferences dialog as follows:

a.) Open the Preferences dialog. 

  - Windows and Linux: Select Window > Preferences

  - Mac OS X: Select IDL > Preferences

b.) Expand and select on the right pane of the preferences dialogthe items, IDL > Paths

c.) Next, on the left side of the dialog, select "IDL path" from thepull down item.

c.) Next, insert your additional IDL program search paths. 

e.) If <IDL_DEFAULT>is not already included in your path list, press the "Insert Default"button.  

f.) Click on Apply and then OK to save your changes.

(Note: The IDL Workbench is not supported on Solaris)

3.) Setting IDL_PATH with the PREF_SET command

Within your IDL session, you can also change the IDL_PATH preference from an IDL command by using the PREF_SET command.  For example:

    PREF_SET, 'IDL_PATH', '<IDL_DEFAULT>:+/home/joeuser/myidllib', /COMMIT

Note that when a preference is committed, the information is saved to the user's idl.pref file.




4.) Customizing the IDL search path through the !PATH IDL system variable

Finally, for advanced IDL users, if needed, you can directly change the "!PATH" IDL system variable to explicitly include your IDL program search paths.  The !PATH IDL system variable is the low level mechanism that underlies the "IDL_PATH" preference.  Note that the "+" expansion character and <IDL_DEFAULT> token will not work with !PATH.  Consequently, any directories and subdirectories that you would like to include directly in the !PATH definition must be added explicitly to this definition. For example:

    !PATH = EXPAND_PATH('<IDL_DEFAULT>:+/home/joeuser/myidllib')

Note also that any changes made directly to !PATH will not persist beyond the current IDL session.

5.) Defining IDL_PATH through a system environment variable

If you define the IDL_PATH system environment variable in your terminal shell to include a custom search path, you can include the <IDL_DEFAULT> token in your definition. 

Linux, Mac OS X, Solaris

For example, on UNIX type systems, from a Bash shell:

    export IDL_PATH='<IDL_DEFAULT>:'/home/joeuser/myidllib

where each path is separated by a ":" (colon) character and there are not any spaces before or after the colon.


To define an environment variable under Microsoft Windows, use the Environment Variables dialog, for example, on Windows 7 select:

    Start > Control Panel > System and Security > System > Advanced system settings > Advanced > Environment Variables

and then to set an IDL_PATH, if this environment variable does not already exist, create a New... System or User variable named:


Then define the environment variable to include <IDL_DEFAULT> at the beginning, followed by the custom path(s), where each path is separated by a ";" (semicolon) character, there are not any spaces before or after the semicolon, and paths should not be quoted (even if there is a space in a directory name), for example:


If you don't wish to include the "idl/examples" directory tree in your search path you can explicitly define the "idl/lib" directory in your path, instead of <IDL_DEFAULT> but prefix that path segment with a "+" character to indicate the entire directory tree should be included in the search path, not just the single directory.  For example (Linux/Solaris, Mac OS X and Windows, perspectively):

    export IDL_PATH=+/usr/local/exelis/idl84/lib:/home/joeuser/myidllib

    export IDL_PATH=+/Applications/exelis/idl84/lib:/home/joeuser/myidllib

    +C:\Program Files\exelis\idl84\lib;C:\Users\joeuser\myidllib

On UNIX type platforms, some users will include an IDL_PATH system environment variable definition in their shell resource file (for example, for Bash shell, ~/.bashrc).

For Mac OS X, if starting an IDL session from a XQuartz/X11 Terminal, one can define this variable i the user's ~/.bashrc file.  If starting from an Apple Terminal window, define the variable in the user's ~/.bash_profile file. Neither of these shell resource files is invoked when starting an IDL session from an AppleScript icon or Apple Alias icon. 

Note: It may be possible to change an IDL preference setting in the current IDL session even if it has been set from a source with a higher precedence than the user preference file mechanism. However, such a change may not be recognized in a new IDL session as long as the higher precedence preference source is still in effect. For a detailed understanding of how IDL system preference settings are affected by preference setting precedence, see "Understanding IDL System Preference Sources" on the IDL Help page titled "About IDL System Preferences".

You can determine the source of your IDL_PATH preference setting with the HELP command, for example:

Distribution File: C:\Program Files\Exelis\IDL83\resource\pref\idl.pref
User File: /home/joeuser/.idl/idl/pref-10-idl_8_3-unix/idl.pref
# Changes Pending: 0

Directories And Search Paths:
  IDL_PATH                      USERFILE = '<IDL_DEFAULT>'



[ Reviewed for external by JU (11-Dec-2014), DS (11-Dec-2014]