* About PATH environment variable on OSX
@ 2013-04-07 18:19 Darren Hoo
2013-04-12 5:05 ` Jan Djärv
2013-04-13 4:59 ` Josh
0 siblings, 2 replies; 9+ messages in thread
From: Darren Hoo @ 2013-04-07 18:19 UTC (permalink / raw)
To: emacs-devel
In the Emacs info manual F.1.1 Grabbing environment variables
it says and I quote:
For the PATH and MANPATH variables, a system-wide method of setting
PATH is recommended on Mac OS X 10.5 and later, using the `/etc/paths'
files and the `/etc/paths.d' directory.
It doesn't work for me. This is my /etc/paths file:
$ cat /etc/paths
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
but (getenv "PATH") gives "/usr/bin:/bin:/usr/sbin:/sbin"
and I haven't used any (setenv "PATH" ...) in my init file.
I can confirm that PATH settings in the /etc/paths and /etc/paths.d are
never picked up by the programs launched from the Finder by writing a
simple Cocoa App.
I can not find any NS-specific code that read the /etc/paths file
either.
So I think the paragraph I quoted above in the manual is incorrect and
should be removed.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-07 18:19 About PATH environment variable on OSX Darren Hoo
@ 2013-04-12 5:05 ` Jan Djärv
2013-04-12 12:39 ` Piotr Kalinowski
2013-04-12 15:01 ` Harald Hanche-Olsen
2013-04-13 4:59 ` Josh
1 sibling, 2 replies; 9+ messages in thread
From: Jan Djärv @ 2013-04-12 5:05 UTC (permalink / raw)
To: Darren Hoo; +Cc: emacs-devel
Hello.
The way to this on newer OSX is to create /etc/launchd.conf and put something like:
setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
in there. I have not tried this myself.
I will test it and fix the documentation.
Jan D.
7 apr 2013 kl. 20:19 skrev Darren Hoo <darren.hoo@gmail.com>:
>
> In the Emacs info manual F.1.1 Grabbing environment variables
> it says and I quote:
>
> For the PATH and MANPATH variables, a system-wide method of setting
> PATH is recommended on Mac OS X 10.5 and later, using the `/etc/paths'
> files and the `/etc/paths.d' directory.
>
> It doesn't work for me. This is my /etc/paths file:
>
> $ cat /etc/paths
> /usr/bin
> /bin
> /usr/sbin
> /sbin
> /usr/local/bin
>
> but (getenv "PATH") gives "/usr/bin:/bin:/usr/sbin:/sbin"
> and I haven't used any (setenv "PATH" ...) in my init file.
>
> I can confirm that PATH settings in the /etc/paths and /etc/paths.d are
> never picked up by the programs launched from the Finder by writing a
> simple Cocoa App.
>
> I can not find any NS-specific code that read the /etc/paths file
> either.
>
> So I think the paragraph I quoted above in the manual is incorrect and
> should be removed.
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-12 5:05 ` Jan Djärv
@ 2013-04-12 12:39 ` Piotr Kalinowski
2013-04-12 14:07 ` Peter Vasil
2013-04-12 15:01 ` Harald Hanche-Olsen
1 sibling, 1 reply; 9+ messages in thread
From: Piotr Kalinowski @ 2013-04-12 12:39 UTC (permalink / raw)
To: emacs-devel
Jan Djärv <jan.h.d@swipnet.se> writes:
> The way to this on newer OSX is to create /etc/launchd.conf and put
> something like:
>
> setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
>
> in there. I have not tried this myself.
I'm on Mac, and I can confirm that this is the way to go, if you want to
have correct PATH for applications that are not started from Terminal.
What you set in /etc/paths and similar will work for the shell
environment in Terminal, and applications started from there.
It is worth noting, that modifying PATH in this way requires you to
relog into graphical session. Actually, unless you run this manually
through launchctl, a full reboot might be required. I can't remember, if
that's the case.
Best regards,
Piotr Kalinowski
--
Intelligence is like a river: the deeper it is, the less noise it makes.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-12 12:39 ` Piotr Kalinowski
@ 2013-04-12 14:07 ` Peter Vasil
2013-04-13 1:24 ` James Felix Black
0 siblings, 1 reply; 9+ messages in thread
From: Peter Vasil @ 2013-04-12 14:07 UTC (permalink / raw)
To: Piotr Kalinowski, emacs-devel
Hi,
With this package you can solve the problem without launchctl and set
the PATH within emacs
https://github.com/purcell/exec-path-from-shell
Best,
Peter
On Fri, Apr 12, 2013 at 2:39 PM, Piotr Kalinowski <pitkali@gmail.com> wrote:
> Jan Djärv <jan.h.d@swipnet.se> writes:
>
>> The way to this on newer OSX is to create /etc/launchd.conf and put
>> something like:
>>
>> setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
>>
>> in there. I have not tried this myself.
>
> I'm on Mac, and I can confirm that this is the way to go, if you want to
> have correct PATH for applications that are not started from Terminal.
> What you set in /etc/paths and similar will work for the shell
> environment in Terminal, and applications started from there.
>
> It is worth noting, that modifying PATH in this way requires you to
> relog into graphical session. Actually, unless you run this manually
> through launchctl, a full reboot might be required. I can't remember, if
> that's the case.
>
> Best regards,
> Piotr Kalinowski
>
> --
> Intelligence is like a river: the deeper it is, the less noise it makes.
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-12 5:05 ` Jan Djärv
2013-04-12 12:39 ` Piotr Kalinowski
@ 2013-04-12 15:01 ` Harald Hanche-Olsen
1 sibling, 0 replies; 9+ messages in thread
From: Harald Hanche-Olsen @ 2013-04-12 15:01 UTC (permalink / raw)
To: jan.h.d; +Cc: emacs-devel, darren.hoo
[Jan Djärv <jan.h.d@swipnet.se> (2013-04-12 05:05:19 UTC)]
> The way to this on newer OSX is to create /etc/launchd.conf and put something like:
>
> setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
>
> in there. I have not tried this myself.
>
> I will test it and fix the documentation.
I think it's better to use /etc/launchd-user.conf instead. This will set PATH for all users. If you use /etc/launchd.conf, you are potentially setting the PATH variable for a whole host of system processes, and this could cause unwanted side effects.
- Harald
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-12 14:07 ` Peter Vasil
@ 2013-04-13 1:24 ` James Felix Black
2013-04-13 12:33 ` Piotr Kalinowski
0 siblings, 1 reply; 9+ messages in thread
From: James Felix Black @ 2013-04-13 1:24 UTC (permalink / raw)
To: emacs-devel; +Cc: Peter Vasil, Piotr Kalinowski
Hello --
In recent versions of OS X, one can modify environment variables for the
currently running graphical session with the launchctl (1) command:
% launchctl setenv PATH /foo/bar/baz:$PATH
... will work as expected.
HTH,
jfb
Peter Vasil writes:
> Hi,
>
> With this package you can solve the problem without launchctl and set
> the PATH within emacs
> https://github.com/purcell/exec-path-from-shell
>
> Best,
> Peter
>
>
> On Fri, Apr 12, 2013 at 2:39 PM, Piotr Kalinowski <pitkali@gmail.com> wrote:
>> Jan Djärv <jan.h.d@swipnet.se> writes:
>>
>>> The way to this on newer OSX is to create /etc/launchd.conf and put
>>> something like:
>>>
>>> setenv PATH /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
>>>
>>> in there. I have not tried this myself.
>>
>> I'm on Mac, and I can confirm that this is the way to go, if you want to
>> have correct PATH for applications that are not started from Terminal.
>> What you set in /etc/paths and similar will work for the shell
>> environment in Terminal, and applications started from there.
>>
>> It is worth noting, that modifying PATH in this way requires you to
>> relog into graphical session. Actually, unless you run this manually
>> through launchctl, a full reboot might be required. I can't remember, if
>> that's the case.
>>
>> Best regards,
>> Piotr Kalinowski
>>
>> --
>> Intelligence is like a river: the deeper it is, the less noise it makes.
>>
>>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-07 18:19 About PATH environment variable on OSX Darren Hoo
2013-04-12 5:05 ` Jan Djärv
@ 2013-04-13 4:59 ` Josh
2013-04-13 12:41 ` Piotr Kalinowski
1 sibling, 1 reply; 9+ messages in thread
From: Josh @ 2013-04-13 4:59 UTC (permalink / raw)
To: Darren Hoo; +Cc: emacs-devel
Others have made good suggestions already, but I prefer the approach
shown at http://paste.lisp.org/display/132476 because with a few elisp
functions I can manage my environment variables in my shell profile as
usual with no need to bother with silly OSXisms.
On Sun, Apr 7, 2013 at 11:19 AM, Darren Hoo <darren.hoo@gmail.com> wrote:
>
> In the Emacs info manual F.1.1 Grabbing environment variables
> it says and I quote:
>
> For the PATH and MANPATH variables, a system-wide method of setting
> PATH is recommended on Mac OS X 10.5 and later, using the `/etc/paths'
> files and the `/etc/paths.d' directory.
>
> It doesn't work for me. This is my /etc/paths file:
>
> $ cat /etc/paths
> /usr/bin
> /bin
> /usr/sbin
> /sbin
> /usr/local/bin
>
> but (getenv "PATH") gives "/usr/bin:/bin:/usr/sbin:/sbin"
> and I haven't used any (setenv "PATH" ...) in my init file.
>
> I can confirm that PATH settings in the /etc/paths and /etc/paths.d are
> never picked up by the programs launched from the Finder by writing a
> simple Cocoa App.
>
> I can not find any NS-specific code that read the /etc/paths file
> either.
>
> So I think the paragraph I quoted above in the manual is incorrect and
> should be removed.
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-13 1:24 ` James Felix Black
@ 2013-04-13 12:33 ` Piotr Kalinowski
0 siblings, 0 replies; 9+ messages in thread
From: Piotr Kalinowski @ 2013-04-13 12:33 UTC (permalink / raw)
To: emacs-devel
James Felix Black <jfb@homonculus.net> writes:
> Hello --
>
> In recent versions of OS X, one can modify environment variables for the
> currently running graphical session with the launchctl (1) command:
>
> % launchctl setenv PATH /foo/bar/baz:$PATH
>
> ... will work as expected.
I just tried it, but it did not work. I've run this command in Terminal,
and then restarted Emacs, but it still had the old value for PATH. And
it makes sense, because set of enviroment variables is given to an
application on start, and does not change later. In order for
application to pick up changes, you need to launch it again. In this
case, you'll need to follow it up with
% killall Dock
Then the applications started will have new environment. (Although I
tested this only for applications started from dock. You could restart
Finder as well ;)
Best regards,
Piotr Kalinowski
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: About PATH environment variable on OSX
2013-04-13 4:59 ` Josh
@ 2013-04-13 12:41 ` Piotr Kalinowski
0 siblings, 0 replies; 9+ messages in thread
From: Piotr Kalinowski @ 2013-04-13 12:41 UTC (permalink / raw)
To: emacs-devel
Josh <josh@foxtail.org> writes:
> Others have made good suggestions already, but I prefer the approach
> shown at http://paste.lisp.org/display/132476 because with a few elisp
> functions I can manage my environment variables in my shell profile as
> usual with no need to bother with silly OSXisms.
Well, I prefer consistency, so that all applications in OSX can see my
TeX installation, as well as applications installed through Homebrew in
/usr/local.
Best regards,
Piotr Kalinowski
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2013-04-13 12:41 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-07 18:19 About PATH environment variable on OSX Darren Hoo
2013-04-12 5:05 ` Jan Djärv
2013-04-12 12:39 ` Piotr Kalinowski
2013-04-12 14:07 ` Peter Vasil
2013-04-13 1:24 ` James Felix Black
2013-04-13 12:33 ` Piotr Kalinowski
2013-04-12 15:01 ` Harald Hanche-Olsen
2013-04-13 4:59 ` Josh
2013-04-13 12:41 ` Piotr Kalinowski
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.