Considering the current version of macOS being Catalina, I am looking for a way to set permanently an environment variable for both: bash and GUI applications.

I have searched online for a while, but all solutions found fail because:

  1. Only applies to older version of macOS: environment.plist, /etc/launchd.config, etc.
  2. Only applies to bash: .profile, .bashrc, etc..
  3. Not permanent solutions: export PATH=..

How to set environment variables permanently for bash and GUI applications?

  • What GUI applications are you using? What environmental variables are you looking to set?
    – benwiggy
    Apr 23 '20 at 10:33
  • 1
    For QtCreator, I need to add /usr/local/bin to PATH and also add one of my own env variables where custom libraries are located. Apr 23 '20 at 10:37
  • 1
    Actually, I found difficult to understand why /usr/local/bin is not by default in the PATH of GUI applications. Apr 23 '20 at 11:22
  • What is happening with QtCreator that you believe that path isn't set correctly? Also, how is launchd not applicable to current version of macOS? launchd is not only current, it's central to macOS! Where did you read this? Please provide links.
    – Allan
    Apr 23 '20 at 15:41
  • using CMAKE message() I can print $ENV{PATH} which return /usr/bin:/bin:/usr/sbin:/sbin (missing /usr/local/bin). This make some tools inaccessible like conan. When I run qtCreator from a terminal, all works perfectly, thus making clear GUI application have a different PATH. To reword, I am not saying launchd is not actual, but that the solutions using launchd.config to set the PATH for GUI applications (as explained in few answers) does not work anymore on Catalina (Tested myself and also reported by other users). Apr 24 '20 at 7:04

You must log in to answer this question.

Browse other questions tagged .