How to set environment variable

In version 13.4, apple banned the use of launchctl setenv it unless you have SIP turned off. I used it to set variables for JetBrains applications to catch my settings from custom vmoptions.

But since 13.4, I don't know how to set variables to enable Phpstorm to read the variables.

I used different options of export PHPSTORM_VM_OPTIONS="/Users/MacHD/Desktop/jet/phpstorm.vmoptions". I have created LaunchAgent, it doesn't help. Then insert it into ~/.zshenv, ~/.bash_profile, ~/.profile ~/.zprofile ~/.zshrc, /private/etc/zshrc, /private/etc/zprofile, it doesn't help either.

Phpstorm misses my vmoptions

P.S. Please do not suggest options where i need to go into the settings and manually specify. I need it to be possible through the bash.


Unfortunately, there's little we can do about this weird Apple decision, which goes against how it works in other operating systems as well.

However, it's not necessary to use the environment variable to specify a custom .vmoptions file.
Instead, you can put the file into the config directory.


Instead of adding them to files like .profile or zprofile which only apply to your shell, try creating a file in ~/.config/environment.d/ which are applied across the session.

for example: ~/.config/environment.d/my_env_vars.conf



Please sign in to leave a comment.