-
Notifications
You must be signed in to change notification settings - Fork 0
/
pre.zsh
56 lines (49 loc) · 1.15 KB
/
pre.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
case $(uname -s) in
"Darwin")
case $(uname -m) in
"arm64")
eval "$(/opt/homebrew/bin/brew shellenv)"
;;
"x86_64")
eval "$(/usr/local/bin/brew shellenv)"
;;
esac
;;
"Linux")
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
;;
esac
# Use bash style arrays
setopt KSH_ARRAYS
# List of brew packages that we want to have in our PATH
brew_paths=(
"imagemagick"
"libpq"
"ruby"
)
# Create an array of paths containing our brew packages
# Caters for both native packages and Rosetta2 packages
# Don't add missing paths
for p in ${brew_paths[*]}; do
if [[ -d "$(brew --prefix)/opt/$p" ]]; then
new_paths[${#new_paths[@]}]="$(brew --prefix $p)/bin"
fi
done
# Update our PATH
export PATH=$(
IFS=:
echo "${new_paths[*]}"
):$PATH
# Unset bash style arrays
unsetopt KSH_ARRAYS
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ]; then
PATH="$HOME/bin:$PATH"
fi
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ]; then
PATH="$HOME/.local/bin:$PATH"
fi