Authors
Articles
Tags
A Morning in Bali

Cleaning Up Old PATH Entries

Published on

Written by Robert Koch

3 min read
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...
Loading languages

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.

Loading languages

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...

Loading languages
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...
Loading languages
Now I've never heard of path_helper before, so I did a quick man lookup which lead me to its description.
Loading languages
Okay now we're getting somewhere, doing a quick ls in /etc/paths.d gave me the answers that I was looking for
Loading languages
Lets take a look inside that com.vmware.fusion.public file...
Loading languages

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
Robert Koch Avatar

👋 I'm Robert, a Software Engineer from Melbourne, Australia. I write about a bunch of different topics including technology, science, business, and maths.

Like what you see?

Find out when I sporadically scream into the void...

Privacy respected. Unsubscribe at anytime.