how to alter $PATH system-wide on MX
Posted: Fri Apr 18, 2025 8:59 am
I have a fair amount of scripts I've written over the years as well as some compiled programs that I want to be accessible to everyone on the system. I used to put them in /usr/local/bin, but MX uses that dir now so I made another bin under /usr/local/. I modified /etc/profile to add my new bin dir & thought that would suffice. NOPE. Worked fine for console logins, but for managed sessions (XFCE, Enlightenment. etc.) the $PATH was clobbered; back to some default value, I suspect by XDG_SOMETHING_OR_OTHER. I noticed that /etc/profile sources /etc/bash.bashrc (which exists on MX systems) so out of desperation, I copied & modified the PATH definitions there. Wonder of wondes, it worked! Both for console logins & managed sessions. Somewhere between /etc/profile & /etc/bash.bashrc you $PATH gets mutilated. I can't tell you how, by what, or WHY. If you know, please share.
TLDR:
To alter $PATH system-wide on MX, copy the PATH definitions from /etc/profile to /etc/bash.bashrc & make your modifications there. Make sure to put them AFTER the interactive check ([ -z "$PS1" ] && return). Of course, this is bash specific. zsh & other shell users, YMMV.
TLDR:
To alter $PATH system-wide on MX, copy the PATH definitions from /etc/profile to /etc/bash.bashrc & make your modifications there. Make sure to put them AFTER the interactive check ([ -z "$PS1" ] && return). Of course, this is bash specific. zsh & other shell users, YMMV.