mirror of
https://github.com/jimeh/dotfiles.git
synced 2026-02-19 12:26:39 +00:00
Fix PATH setup on macOS
This commit is contained in:
24
zshenv
24
zshenv
@@ -2,9 +2,27 @@
|
|||||||
# ZSH Environment Setup
|
# ZSH Environment Setup
|
||||||
#
|
#
|
||||||
|
|
||||||
# Ensure values in path variable are unique.
|
# Ensure values in path variable are unique
|
||||||
typeset -U path
|
typeset -U path
|
||||||
|
|
||||||
|
# Prevent loading ZSH startup from files /etc on macOS. The /etc/zprofile file
|
||||||
|
# screws around with PATH, so we want to avoid it, and instead manually load the
|
||||||
|
# files we care about.
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||||
|
# Disable loading startup files from /etc
|
||||||
|
unsetopt GLOBAL_RCS
|
||||||
|
|
||||||
|
# Setup default PATH just like /etc/zprofile does
|
||||||
|
if [ -x "/usr/libexec/path_helper" ]; then
|
||||||
|
eval `/usr/libexec/path_helper -s`
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load /etc/zshenv if it exists
|
||||||
|
if [ -f "/etc/zshenv" ]; then
|
||||||
|
source "/etc/zshenv";
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Path helpers
|
# Path helpers
|
||||||
path_list () {
|
path_list () {
|
||||||
print -l "${(@)path}"
|
print -l "${(@)path}"
|
||||||
@@ -49,10 +67,10 @@ if [[ "$TMPDIR" == "/var/folders/"* ]] || [[ "$TMPDIR" == "" ]]; then
|
|||||||
mkdir -p "$TMPDIR"
|
mkdir -p "$TMPDIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Ensure basic systems paths are in desired order.
|
# Ensure basic systems paths are in desired order
|
||||||
path_prepend "/sbin"
|
path_prepend "/sbin"
|
||||||
path_prepend "/bin"
|
|
||||||
path_prepend "/usr/sbin"
|
path_prepend "/usr/sbin"
|
||||||
|
path_prepend "/bin"
|
||||||
path_prepend "/usr/bin"
|
path_prepend "/usr/bin"
|
||||||
path_prepend "/usr/local/sbin"
|
path_prepend "/usr/local/sbin"
|
||||||
path_prepend "/usr/local/bin"
|
path_prepend "/usr/local/bin"
|
||||||
|
|||||||
12
zshrc
12
zshrc
@@ -2,9 +2,11 @@
|
|||||||
# Z-Shell Init
|
# Z-Shell Init
|
||||||
#
|
#
|
||||||
|
|
||||||
# Fix PATH re-ordering done by macOS, by loading ~/.zshenv again.
|
# In our zshenv file we have on macOS disabled loading ZSH startup files from
|
||||||
if [[ "$(uname)" == "Darwin" ]] && [ -x "/usr/libexec/path_helper" ]; then
|
# /etc to avoid /etc/zprofile messing up our carefully constructed PATH. So we
|
||||||
source "$HOME/.zshenv"
|
# need to manually load the other files we care about.
|
||||||
|
if [[ "$OSTYPE" == "darwin"* ]] && [ -f "/etc/zshrc" ]; then
|
||||||
|
source "/etc/zshrc";
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@@ -75,8 +77,8 @@ fpath=("$DOTZSH/completion" "${fpath[@]}")
|
|||||||
source "$DOTZSH/aliases.zsh"
|
source "$DOTZSH/aliases.zsh"
|
||||||
|
|
||||||
# OS specific
|
# OS specific
|
||||||
if [[ "$(uname)" == "Darwin" ]]; then source "$DOTZSH/macos.zsh"; fi
|
if [[ "$OSTYPE" == "darwin"* ]]; then source "$DOTZSH/macos.zsh"; fi
|
||||||
if [[ "$(uname)" == "Linux" ]]; then source "$DOTZSH/linux.zsh"; fi
|
if [[ "$OSTYPE" == "linux"* ]]; then source "$DOTZSH/linux.zsh"; fi
|
||||||
|
|
||||||
# Utils
|
# Utils
|
||||||
source "$DOTZSH/emacs.zsh"
|
source "$DOTZSH/emacs.zsh"
|
||||||
|
|||||||
Reference in New Issue
Block a user