I know that MacOS generally does not follow the XDG conventions. Is it still safe to define XDG variables (such as $XDG_CONFIG_HOME and others) in MacOS without breaking the system? I want to declutter my $HOME and want to adopt the XDG directory structure for my dotfiles.

In case it matters I'm using MacOS 12 and plan on staying on Monterey for a while.

New contributor
user15670876 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
  • Welcome to Ask Different. Here’s a beautiful thing. You can set up Time Machine and experiment. If you find a huge problem, you can easily erase and reinstall from backup before you changed. And with Time Machine, you can go back months if you keep a good record when you started.
    – bmike
    Commented Jun 11 at 15:47
  • Thanks! Although I do have Time Machine set up, I'm not really sure that I want to experiment with this. I'm worried that setting XDG variables might impact the system in (at least for me) unexpected ways, which would be not that easy to revert. On reinstalling from backup: this would indeed be an option but if I find a huge problem I would lose months of progress - which I don't really want. Commented Jun 11 at 16:21
  • Sorry for continuing off track, but losing months of work sounds like you don’t have a backup at all. I was going to post an answer but the correct one is already there.
    – bmike
    Commented Jun 11 at 17:17
  • Maybe I phrased it poorly. What I meant by that is that in case this becomes a problem in the future and I can only identify the problem several months after the configuration that caused the problem is already made I would have to revert to a state before the configuration is made. And if I don't know which configuration cause the problem I'd have to revert my whole system, thus losing months of progress. This was my thought process, cause I was worried system configs could change through this. Commented Jun 11 at 18:00
  • Wonderful. You’re being over cautious. Carry on with your changes that are safe and keep your backup just in case we don’t know everything
    – bmike
    Commented Jun 11 at 19:03

1 Answer 1


We have quite a few questions on this site from people who want to make sure that their environment variables defined in a shell are also set for Finder and any applications started from there. And, to be honest, most of the documented methods don't work any more. For your case, that's probably a win, because as long as you define your XDG_ variables in .bashrc/.zshrc but start your applications via Finder (or with open -a), these applications won't even see the variables.

  • 2
    Thats very good to know - all my cli tools are built for using XDG configs anyway so this is definitely a win for me. Thank you! Commented Jun 11 at 18:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .