How to add a directory to your PATH. Classic Julia Evans piece here, answering a question which you might assume is obvious but very much isn't.
Plenty of useful tips in here, plus the best explanation I've ever seen of the three different Bash configuration options:
Bash has three possible config files:
~/.bashrc
,~/.bash_profile
, and~/.profile
.If you're not sure which one your system is set up to use, I'd recommend testing this way:
- add
echo hi there
to your~/.bashrc
- Restart your terminal
- If you see "hi there", that means
~/.bashrc
is being used! Hooray!- Otherwise remove it and try the same thing with
~/.bash_profile
- You can also try
~/.profile
if the first two options don't work.
This article also reminded me to try which -a again, which gave me this confusing result for datasette
:
% which -a datasette
/opt/homebrew/Caskroom/miniconda/base/bin/datasette
/Users/simon/.local/bin/datasette
/Users/simon/.local/bin/datasette
Why is the second path in there twice? I figured out how to use rg
to search just the dot-files in my home directory:
rg local/bin -g '/.*' --max-depth 1
And found that I have both a .zshrc
and .zprofile
file that are adding that to my path:
.zshrc.backup
4:export PATH="$PATH:/Users/simon/.local/bin"
.zprofile
5:export PATH="$PATH:/Users/simon/.local/bin"
.zshrc
7:export PATH="$PATH:/Users/simon/.local/bin"
Recent articles
- Phoenix.new is Fly's entry into the prompt-driven app development space - 23rd June 2025
- Trying out the new Gemini 2.5 model family - 17th June 2025
- The lethal trifecta for AI agents: private data, untrusted content, and external communication - 16th June 2025