From: Andrew Janke <andrew@apjanke.net>
To: Mikael Magnusson <mikachu@gmail.com>,
Kurtis Rader <krader@skepticism.us>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: PSA: Mac OS X El Capitan upgrade might break your $PATH
Date: Fri, 31 Jul 2015 17:05:32 -0400 [thread overview]
Message-ID: <55BBE31C.5050909@apjanke.net> (raw)
In-Reply-To: <CAHYJk3S-W_FYWEidfhC_g62=8B3hRLoyGnnOQsJcy4FPp9Ct5g@mail.gmail.com>
On 7/31/15 2:53 PM, Mikael Magnusson wrote:
> On Fri, Jul 31, 2015 at 6:35 PM, Kurtis Rader <krader@skepticism.us> wrote:
>> A public service announcement for those running Zsh on Mac OS X.
>>
>> Upgrading to El Capitan (OS X 10.11) will install a /etc/zprofile that
>> contains
>>
>> # system-wide environment settings for zsh(1)
>> if [ -x /usr/libexec/path_helper ]; then
>> eval `/usr/libexec/path_helper -s`
>> fi
>>
>> On a new login shell that will be sourced after your $HOME/.zshenv. If you
>> set your $PATH in your .zshenv the /usr/libexec/path_helper program will
>> alter the order of the directories. The order appears random so it's
>> probably using a hashed set to avoid having the same directory appear more
>> than once in the result.
>>
>> You can't remove /usr/libexec/path_helper due to the new security
>> mechanisms (at least not without booting from a recovery disk) but you can
>> remove /etc/zprofile which is what I did to keep my $PATH from being mucked
>> with.
> That's good news, they used to have that code in /etc/zshenv which
> meant you had _no_ way to override it. It only took them a few years
> to fix this.
>
> As a sidenote, it's not a great idea to set your path in .zshenv, you
> should probably move those settings to your .zprofile. (Otherwise,
> running a script that uses zsh will not use the $PATH from the
> environment, which can break things in some situations).
>
I suspect the order of entries in path_helper is determined by
alphabetical ordering of the filenames in /etc/paths.d, where
path_helper locates the files that come after the default system paths.
That "40-" in XQuartz looks like an rcdir-style technique to enforce
ordering, and I think the XQuartz folks know what they're doing with the
OS X system stuff. (This is on 10.9.)
$ ls -l /etc/paths.d
total 16
-rw-r--r-- 1 root wheel 13 Aug 11 2014 40-XQuartz
-rw-r--r-- 1 root wheel 12 May 7 21:06 TeX
Playing around with this seems to support that theory. Files read in
order, duplicate entries removed after the first occurrence.
#/bin/sh
# install-hello-paths - script to test path_helper behavior
echo /hello/world > /etc/paths.d/01-hello
echo /hello/world > /etc/paths.d/99-hello
One other El Capitan change: the system-supplied zsh (5.0.8) appears to
be compiled with /usr/local/share/zsh/site-functions in the default
$fpath, which was not the case for earlier versions of OS X. This is
probably related to the "rootless" stuff that locks down /usr outside
/usr/local/.
Cheers,
Andrew
next prev parent reply other threads:[~2015-07-31 21:13 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 16:35 Kurtis Rader
2015-07-31 17:22 ` Bart Schaefer
2015-07-31 18:53 ` Mikael Magnusson
2015-07-31 21:05 ` Andrew Janke [this message]
2015-07-31 22:01 ` Kurtis Rader
2015-07-31 22:29 ` Andrew Janke
2015-07-31 22:49 ` Kurtis Rader
2015-07-31 22:10 ` Kurtis Rader
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=55BBE31C.5050909@apjanke.net \
--to=andrew@apjanke.net \
--cc=krader@skepticism.us \
--cc=mikachu@gmail.com \
--cc=zsh-users@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).