Setting up your IDL Environment

When you first launch IDL from the command line, it will search for two environment variables in your (linux) shell environment called 'IDL_DIR' and 'IDL_PATH'. The IDL_DIR is properly set by default for any machines in the department. The $IDL_PATH is an important one for you to set because it will tell IDL where to search for .pro files when you ask it to compile a function or procedure. If you don't specify a path then IDL will only search for files in your current directory. For the sake of convenience and organization, it is generally much better to specify a folder that IDL will always search in when looking for .pro files. Then, you can keep all your files in one place.

Therefore the first thing to do before you start working with IDL is to set a convenient path. Typically something like ~/idl/ is sensical, but anything will work according to your preferences. To add a folder of your choice to your IDL path, open your ~/.cshrc file in any text editor of your choice (note: these instructions are for departmental computers only). Once you've opened your ~/.cshrc file, add the following line somewhere:

setenv IDL_PATH +$HOME/idl:+$IDL_DIR/lib:+$IDL_DIR/contrib:+$IDL_DIR/examples

This adds a number of folders to your IDL path. In this case, the first folder added is the idl folder in your home directory ($HOME/idl). Now you just have to create an idl folder in your home directory, and IDL will always search this folder when compiling functions and procedures. In other words, any .pro files that you save into this directory will be accessible from IDL, regardless of what directory you are actually in. The plus sign that immediately precedes $HOME/idl tells IDL that it should also search sub-directories of this folder for additional .pro files. In general this is a good idea but sometimes IDL can be slow at compiling .pro files if it has many directories to search. The additional folders included in the above line add additional (and useful) IDL libraries. In particular +$IDL_DIR/contrib includes the IDLAstro Library, some additional programs developed locally, and a variety of other additional libraries. The details of the files included in the AstroLibrary can be found here.

Once you've updated your ~/.cshrc file, you either have to close and re-open any terminal windows you have open, or else execute the following command in every terminal window:

source ~/.cshrc