Created
June 4, 2014 23:28
-
-
Save jeffmccune/c59edc4b760fb12ded7c to your computer and use it in GitHub Desktop.
/usr/libexec/path_helper is not
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# F!@#!$ing Apple calling /usr/libexec/path_helper from the always executed | |
# /etc/zshenv which has the result of re-ordering the PATH in a way we can't | |
# control. | |
# | |
# See: https://github.com/sorin-ionescu/prezto/issues/381#issuecomment-12745303 | |
# Approach: | |
# 1: Store our current path, which is messed up by apple. | |
# 2: Determine the Apple default path. | |
# 3: Subtract the default path from the screwed up path. | |
# 4: Append the default path to the results of 3. | |
# | |
# Result: Our stuff will be first, and in the correct order, followed by the | |
# path_helper defaults | |
if [ -x /usr/libexec/path_helper ]; then | |
FP="${PATH}" | |
eval "$(PATH='' /usr/libexec/path_helper)" | |
DP="${PATH}" | |
PATH=$(/usr/bin/ruby -e "fp=%{$FP}.split(%{:}); dp=%{$DP}.split(%{:}); p=fp-dp+dp; puts p.join(%{:});") | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment