Sublime Forum

Why doesn't Sublime3 use global PATH variable? And how can I force it to use it?

#21

The issue is one I’ve run across frequently. The problem is that the GUI (Gnome, KDE, etc.) is equivalent to a login shell. In the olden days you logged in on a terminal and that was your environment. Now the GUI performs a login. The shells you run in the terminals have their own environment. X is the underlying graphical environment so you want to modify the environment of your X session. For my Ubuntu the display manager/X session manager reads ~/.profile when you log in. This will also be used by bash when bash is run as a login shell only. I’ve gotten in the habit of setting my path in ~/.profile then putting anything else in the appropriate .zshrc or .bashrc file. The *rc files are read when the shell is interactive. This will make the path available to all apps run in your X session (including Sublime no matter how it’s launched) and includes your shells running in a Terminal.

I know it’s an older thread but this does answer your question of why it’s not working when you modify .bash_profile.

1 Like

#22

I faced nearly the same problem trying to setup GoGuru and other packages for golang development. I’m using Mac and /bin/zsh and any changes to .bash_profile and .bashrc had no effect for sublime text.

Finally, I’ve found this package https://packagecontrol.io/packages/Environment%20Settings which allows to execute shell script from env_file which sets environment variable. I think this may be the third way to solve your problem

0 Likes

#23

That shouldn’t be necessary in recent versions unless you have a very slow bashrc, or don’t have zsh set as your login shell. A copy of your console output would help diagnose.

0 Likes