thoughtbot/dotfiles

What's the recommended way to add binaries to $PATH?

PaulRBerg opened this issue · 2 comments

I love this repo but I'm new to zsh and I'm not quite sure what's the best place to add my binaries to the $PATH. In Bash, I used to do that in .bash_profile. Is .zshrc the zsh analogue? Or .zshenv?

Side note: it might be worth it to enable discussions in this repository. I would have opened a discussion instead of an issue.

We set the path in .zsh/configs/post/path.zsh. You could set your own by layering in a file in zsh/configs/post that runs after that, or you could set it in your own .zshrc.local file, which gets loaded after the configs directory's contents get loaded.

Check out the files here to see the way this gets loaded:

dotfiles/zshrc

Lines 8 to 38 in 42a313b

_load_settings() {
_dir="$1"
if [ -d "$_dir" ]; then
if [ -d "$_dir/pre" ]; then
for config in "$_dir"/pre/**/*~*.zwc(N-.); do
. $config
done
fi
for config in "$_dir"/**/*(N-.); do
case "$config" in
"$_dir"/(pre|post)/*|*.zwc)
:
;;
*)
. $config
;;
esac
done
if [ -d "$_dir/post" ]; then
for config in "$_dir"/post/**/*~*.zwc(N-.); do
. $config
done
fi
fi
}
_load_settings "$HOME/.zsh/configs"
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local

Thanks for your answer, @geoffharcourt. Going to close this issue now.