X
110 Rate this article:
No rating

INTERNAL: Getting environment variables into IDLDE.app on Mac OS X

Anonym

On Mac OS X, if you setup environment variables in a terminal environment and then use the idlde icon to start IDL, you will find that you environment variables will not be read by IDL. 

Two methods you can use to workaround this issue are shown below:

Source your terminal resource file in the application init file

1) Define your environment variables in a resource file. For example, if you are using a bash shell (the default shell used by Mac OS X), the file would be "~/.bashrc".

2)  Open the following script in a text editor:

/Applications/itt/idl/idl81/idlde/idlde.darwin.x86_64.app/Contents/MacOS/init

3)  Under the line #!/bin/sh, add a command to source the resource file. For example, if you are using the bash shell, the command would be:

source ~/.bashrc

4) Save and close the init script. Then try starting IDL using the icon. IDL should start with the environment variables from your resource file included.

Create an environment.plist file

Another option with Mac OS X 10.7 is to create a file called "environment.plist" and then populate the file with needed environment variable definition. For example, from an X11 terminal window, issue the following 3 commands:

mkdir ~/.MacOSX
touch ~/.MacOSX/environment.plist
open ~/.MacOSX/environment.plist

At this point the Apple Property List Editor application will open a window titled "environment.plist". Next:

1)Enter a new Key name that corresponds to the system environment variable name:  MYVAR

2)Enter the environment variable definition (for example):
Hello World!

3)Close the plist editor window and save the new settings.

Log out of your Mac OS X user session and then log back in.  When you start a new IDL session, when you issue the command:

You should see the output:
Hello World!