Skip to main content
// 09·100DTO·software

Cleaning Up Old PATH Entries

Finding out where all those pesky paths entries are being set.

By Robert Koch23 APR 20233 MIN READ
A Morning in Bali
FIG. 01A Morning in Bali
TLDR: Look inside /etc/paths.d for path entries that haven't been cleaned up.
A quick note about something I wish I had known about a long time ago. I recently had the a fun little error when compiling some code...
FIG. 02

Very annoying! This is probably going to lead me down a rabbit hole somewhere later but at the time I just wanted to get the project I was working on running. So I investigated what value(s) in my path were causing the error, I ran this useful command to split the path based on colons to easily parse it.

FIG. 03

This gave me the contents of my path variable in a more human readable format. After staring at it for a few minutes I saw the culprit...

FIG. 04
VMWare I got you! Slight problem, I uninstalled VMware a while back. So the most likely reason it's sill in my path is during the uninstall the path doesn't get pruned, buggar! Okay so now I have to find where this entry is added to my path. I'm quite farmiliar with my .zshrc file so I knew it wasn't in there, which really did confuse me for a while. I spent a good hour looking through my path entries and couldn't find anything. I even tried a general search in my $HOME for PATH= - no luck.
After some time scouring Stack Overflow, Vmware documentation, and the Apple forums I found a clue. Looking into some documentation and consulting ChatGPT, I found that there is a default set of initialization files located in /etc. Having a look in there I found /etc/zprofile and inside it this peculiar code...
FIG. 05
Now I've never heard of path_helper before, so I did a quick man lookup which lead me to its description.
FIG. 06
Okay now we're getting somewhere, doing a quick ls in /etc/paths.d gave me the answers that I was looking for
FIG. 07
Lets take a look inside that com.vmware.fusion.public file...
FIG. 08

That's what we're looking for! So now all that's left to do is delete the file.

There you have it, a (somewhat) hidden utility to append directories to the PATH. Next time you're struggling to find a PATH entry have a look inside /etc/paths.d

// SIMILAR ESSAYS

// SUBSCRIBE

Like what you see?

Find out when I sporadically scream into the void. Long-form notes from a one-person engineering studio in Melbourne — usually code, sometimes maths, no fluff.

no spam · unsubscribe anytime

powered by beehiivRSS feed →