> Is there a way I can avoid having to hardcode my entire PATH

Not that I know of. Personally I do just hard-code the entire PATH, and 
while I agree it's a god-awful ugly hack, realize that if we can't figure 
out how to add stuff to the global PATH other than to hard-code it, 
*neither can anybody else* other than Apple. So it really ought to be 
reasonably safe, since the only time Apple is likely to change the default 
global PATH is during a major OS update, and said major updates wipe out 
/etc/launchd.conf. (Make backups, as a result!)

I have to suggest, though—I know the QS devs don't want to change the 
*default* behavior of the "Run" action, but might it be possible to have a 
spot in the preferences to define environment variables that should apply 
to commands run by Quicksilver? TextMate and other development tools, for 
instance, have a tendency to have this.

On Sunday, April 6, 2014 5:56:09 PM UTC-4, lopmenhed wrote:
>
> Daniel, you are right that I've installed my own copy of Python, in my 
> case as part of Anaconda <http://docs.continuum.io/anaconda/index.html>, 
> a popular Python distribution that comes with a bunch of libraries and an 
> IDE.
>
> I think you have diagnosed the issue with /usr/bin/env python accurately. 
> When I run type python from a terminal window I get the desired 
> (Anaconda) path, but when I run M-x shell in Emacs and then run type 
> python from the shell buffer I get the default /usr/bin/python.
>
> Sounds like launchd.conf may be the only comprehensive solution. However, 
> apparently 
> launchd does not do any parameter 
> expansion<http://apple.stackexchange.com/a/106372/60655>so I cannot do 
> something like
>
> setenv PATH /Users/lop/anaconda/bin:$PATH
>
>
> Is there a way I can avoid having to hardcode my entire PATH (or whatever 
> the PATH should be at this point in initialization)? This seems fragile:
>
> setenv PATH /Users/lop/anaconda/bin:/everything/else:/even_more/
>
>
> BTW, while researching this I stumbled onto 
> EnvPane<https://github.com/hschmidt/EnvPane>which seems to provide a nicer 
> interface for launchd.conf for per-user 
> settings. However, I don't see a way to handle parameter expansion there 
> either.
> On Tuesday, April 1, 2014 9:03:20 PM UTC-4, Daniel wrote:
>>
>> Aha! Looks like you've installed Python...maybe using a version manager? 
>> Not familiar with Python tooling. Somewhere other than /usr(/local)/bin, 
>> though. GUI apps don't pick up changes to your PATH that you make in 
>> .bashrc/.profile/etc. So when QS executes /usr/bin/env python, what env 
>> finds is /usr/bin/python, and PYTHONPATH and all the other associated 
>> variables are also not set/set to their system defaults.
>>
>> In Snow Leopard, you could fix this by creating a file 
>> `~/.MacOSX/environment.plist`, a dict of VAR_NAME -> 'value'. That no 
>> longer works, and unfortunately there's no longer a way to do it per-user 
>> at all. What you *can* do is edit /etc/launchd.conf—plain text file, 
>> syntax is `setenv VAR_NAME value`. This will apply to the entire system, 
>> though, so be at least a *little* cautious of putting things *ahead* of 
>> the normal PATH, which is what you'd need in this case. (I do it, but there 
>> are certainly dangers.)
>>
>> If QS is the only application you care about this for (but it's often 
>> not—any IDE or other tool that can run scripts probably wants the same 
>> envvars as your shell as well), you could also make a script, shell, Apple 
>> or otherwise, that launches Quicksilver after manually setting the PATH. As 
>> long as QS is launched with this script, it will have the right PATH and 
>> shell scripts will work. (Google `appify.sh` for how to turn such a script 
>> into an "application" that will work correctly if you add it to your login 
>> items.)
>>
>> Extending this slightly, if *most* of the apps that matter are launched 
>> manually, after you log in, you could have launchd run a script on login 
>> that turns back around and calls `launchctl setenv VAR val...`. Any apps 
>> already launched won't be affected, though, and launchd does stuff in 
>> undefined order. Although there are ways to semi-force it to do stuff in 
>> order, so maybe...
>>
>> Caaaaan you tell I've dealt with this before? :/ environment.plist really 
>> was a near-perfect solution, I don't know why it was removed. Hope the 
>> above is helpful.
>>
>> On Monday, March 31, 2014 10:14:09 PM UTC-4, lopmenhed wrote:
>>>
>>> OK, thank you both. For posterity: `#!/usr/bin/env python` did not work 
>>> for me, but providing the full path to Python did.
>>>
>>> On Monday, March 31, 2014 2:39:23 PM UTC-4, 1.61803 wrote:
>>>>
>>>> On Monday, March 31, 2014 12:35:50 AM UTC+2, lopmenhed wrote:
>>>>
>>>>> Thank you, 1.61803. But do you have a specific suggestion about how 
>>>>> this might help? I'm unable to see how it fits in.
>>>>>
>>>>
>>>> on open files -- instead of process text
>>>> do shell script "/usr/bin/python " & command
>>>>
>>>> and the necessary adjustments.
>>>>
>>>> But it seems that Rob's suggestion works by itself. So I would stick to 
>>>> the builtin action.
>>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Quicksilver" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/blacktree-quicksilver.
For more options, visit https://groups.google.com/d/optout.

Reply via email to