The difference may result from the fact that you launch CLI applications made with FPC from the shell, but GUI applications based on the LCL from the Finder.
For permanent storage of Environment variables, macOS uses two approaches: Environment variables for use by the shell and CLI programs are stored in
~/.bash_profile (you may want to type
more ~/.bash_profile to display the current contents of this file on your computer), while environment variables for GUI applications are stored in
~/.MacOSX/environment.plist (for Mac OS X Lion and Mountain Lion only) or in
/etc/launchd.conf (for newer versions of macOS).
Additionally, the syntax is slightly different: In
~/.bash_profile the environment variables are set with
export PATH=$PATH:/Library/PostgreSQL/8.4/bin
but with
setenv JRUBY_HOME /Applications/Dev/jruby
in
/etc/launchd.conf.