8131
What to do in case AppleScript does not inherit the system variables defined in the bash shell file
On Mac OS, in some cases the AppleScript (.app) does not inherit the system variables defined in the bash shell file such as the .bashrc file.
This may affect IDL/ENVI in different configurations: one example is the configuration of the IDL-Pyhton Bridge, which requires the definition of various environment variables in the .bashrc file.
How to identify the issue – example of the IDL-Python bridge
- Environment variables are defined in the .bashrc file
- The IDL Python bridge is failing when starting IDL from the .app
- The IDL Python Bridge is working fine when starting IDL from a terminal instead of using the .app
How to fix the issue so Harris products can be started using the .app:
- Open Finder and navigate to the .app file. For example, for idlde 8.7: /Applications/harris/idl87/idlde/idlde.darwin.x86_64.app
- Right click on the .app and choose Show Package Contents
- Locate the “init” file inside the /Contents/MacOS/ directory: this is the bash script to launch the IDL workbench
- Open the “init” file with a text editor
- Add the following line to this “init” file anywhere before the final exec command: source ~/.bashrc

- Save the file and try again to launch the application using the .app: it should now take into account the system variables defined in the .bashrc file
Another option is to directly define the required environment variable in the “init” file inside the /Contents/MacOS/ directory (instead of sourcing the bash shell file)
-------------------------------------------------------------
created by BC on 4/9/2019, reviewed by MM on 4/9/2019