Sublime Forum

What is the Path of ST3 when launched from Yosemite Finder?

#1

I’m having a strange situation where after editing .bash_profile my pandoc command fails when invoked from the Terminal, but it still works when invoked from (Finder-launched) ST3, use the Pandown package. I want to know what the Finder-launched app can see that Terminal can’t. Is there some kind of equivalent to “echo $PATH” that I can type into the ST3 console? Or some other way to discover the path of the Finder-launched ST3?

0 Likes

#2

Launch Sublime Text from the Finder, then from the terminal you can try running:

ps -e | grep Sublime making sure to use a capital S for Sublime in that command.

this will give output something like this:

[quote] 4107 ?? 0:00.87 /Applications/Sublime Text.app/Contents/MacOS/Sublime Text
4109 ?? 0:00.27 /Applications/Sublime Text.app/Contents/MacOS/plugin_host 4107
4133 ttys002 0:00.00 grep Sublime[/quote]

Hope this helps!

0 Likes

#3

Sorry, I didn’t mean the path to the Sublime Text app itself (maybe I should edit the title of the thread to try to describe my problem better).

I mean that when Finder-launched applications run scripts, including Terminal commands such as pandoc, they apparently access these using a different PATH variable to the one you get in the Terminal with $PATH.

I am trying to work out why using pandoc (via ST3 package pandown) works fine, but pandoc from the terminal returns an error “pandoc: xelatex: createProcess: runInteractiveProcess: exec: inappropriate type (Not a directory)”. So I’m trying to work out what paths Finder-launched ST3 uses when it runs terminal commands.

Hope that’s a bit clearer!

0 Likes

#4

You can type the following Python commands into the ST3 console:

import os print(os.environ'PATH'])
FWIW, applications launched by Finder have a separate environment to the environment set up in a typical command shell. This Stack Overflow answer has some discussion how to configure different environments in OS X.

0 Likes

#5

@blurk thank you,

import os print(os.environ'PATH'])

gave me what I needed to know. (eg that the path that Finder-launched ST3 sees is different from the one reported by Terminal, eg by typing echo $PATH)

That Stack Overflow explanation is also very clear, but I think it’s a little out of date (up to 10.6), and in particular the entries it lists for where GUI apps look for path,

and

aren’t supported any more. I haven’t been able to work out where, in Yosemite, GUI -launched apps get their PATH variable from. I guess this is no longer a ST3-specific question though, but rather an OSX Yosemite one, so I should ask on Apple community forums. Thank you all.

0 Likes