Chores icon indicating copy to clipboard operation
Chores copied to clipboard

/usr/local/bin not on search path when launching from Cocoa

Open peterfriese opened this issue 8 years ago • 2 comments

Trying to launch any shell script that resides in /usr/local/bin will fail, as it is not on the search path. Consequently, even "which foobar.sh" will not return the path of any script in /usr/local/bin.

See http://stackoverflow.com/questions/26926338/different-path-from-console-and-cocoa and https://bugs.swift.org/browse/SR-566 for more background.

peterfriese avatar Feb 22 '16 10:02 peterfriese

I can't actually reproduce this issue with Swift on OS X:

$ cat main.swift 
import Chores

print((>["env"]).stdout)
$ ./.build/debug/test|grep ^PATH
PATH=/Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2015-12-22-a.xctoolchain/usr/bin:[…]

The PATH is identical to the one of the parent shell. The Swift bug seems to be related to using Swift Foundation, which is at the moment only used on Linux, which Chores does not support right now.

Could you elaborate on where you're seeing this?

neonichu avatar Feb 22 '16 14:02 neonichu

Interesting. When launching from inside Xcode, the environment of a Cocoa app or commandline app are different from what they are when launching from the command line.

Rather annoying, but hardly your fault.

peterfriese avatar Feb 23 '16 00:02 peterfriese