jviotti
jviotti

Reputation: 18909

Sublime Text 2 and bin paths

If I print my $PATH in a terminal (zsh) I get:

λ echo $PATH
/Users/jviotti/.nvm/v0.11.13/bin:/Users/jviotti/bin/Sencha/Cmd/4.0.2.67:/usr/sbin:/usr/local/bin:/usr/local/sbin:/sbin:/opt/bin:/Users/jviotti/bin:/home/jviotti/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin

However if I print the environment variables from Sublime Text 2 console I only get:

>>> print(os.environ['PATH'])
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/jviotti/bin

Sublime Text 2 detects that I'm using Zsh, however most of my paths are missing.

How can I fix this?

Upvotes: 0

Views: 479

Answers (1)

MattDMo
MattDMo

Reputation: 102852

When you launch Sublime via the command line with the subl command, it picks up your current PATH from your shell. However, files launched from the GUI have a separate PATH, and this is what needs to be changed. Please check out my answer over at Unix.SE for detailed instructions on how to set the PATH for OS X programs launched via the Dock or Finder. This has only been tested on Mountain Lion (there is a different method for Lion), and while it should work on Mavericks I can't guarantee it. It does require having admin privileges.

Briefly, you need to edit /etc/launchd.conf (or create it if it doesn't exist) to include all the entries you want, then restart your computer for the changes to take effect. Keep in mind that this will affect all GUI programs, not just Sublime, so if you start getting unexplained behavior or errors, this may be the reason.

Good luck!

Upvotes: 1

Related Questions