Recent

Author Topic: Problems using GetEnvironmentVariable  (Read 8923 times)

carl_caulkett

  • Sr. Member
  • ****
  • Posts: 298
Re: Problems using GetEnvironmentVariable
« Reply #15 on: June 18, 2017, 02:56:16 pm »
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

Code: Bash  [Select][+][-]
  1. export PATH=$PATH:/Library/PostgreSQL/8.4/bin

but with

Code: Bash  [Select][+][-]
  1. setenv JRUBY_HOME /Applications/Dev/jruby

in /etc/launchd.conf.

I suspect the difference may be the fact that I'm using Fish as my shell as opposed to Bash. The Fish method of setting environment variables doesn't appear to be sufficient to affect GUI apps. I made the changes that you suggested to /etc/launchd.conf but that didn't seem to make any difference. I may have done something wrong here, of course!
"It builds... ship it!"

macOS 12.3 Monterey
Lazarus 2.3.0 (from src)
FPC 3.3.1 (from src)

 

TinyPortal © 2005-2018