0

This question already has an answer here:

Before writing this question, I'd like to state that I use Linux on a daily basis, which is why I'm creating this post to extend my knowledge of the other main operating systems I'm concerned about, Mac OS and Windows.

I'm developing a NodeJS application that needs to read a configuration in order to understand what to do, and allow the user to customize some of the inner workings of the application through this configuration.

However, this application is also cross-platform. And I know that operating systems have different file structures for their own convenience. On a lot of Linux operating systems (if not all) I know that configurations are most commonly put in ~/.config/<app> or likely ~/.<app>/config if the first is not applicable...

Although, my knowledge does not expand far enough to know if that's the same for Windows and Mac OS?

What is considered the best place to put application configurations on Linux, Mac OS, and Windows?

marked as duplicate by durron597, greyfade, Community Oct 14 '15 at 16:47

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    For linux you might be interested in XDG_CONFIG_HOME and XDG specification – CodesInChaos Oct 14 '15 at 16:17
  • @CodesInChaos, Ah yes. I've heard briefly of XDG. Definitely something I should look into. – user160274 Oct 14 '15 at 16:20
  • Note that many applications that use XDG, only support XDG_*_HOME and not those preference ordered search paths. – CodesInChaos Oct 14 '15 at 16:30
  • Your question mentions OS configuration and application configuration as if they were one and the same. I'd take a stab that you actually mean application configuration - correct? – Robbie Dee Oct 14 '15 at 16:37
  • Yes. I'm making application that has a configuration. But it's also cross-platform. So my question was where the appropriate place to put a application's configuration on Mac OS, Linux, and Windows (since they all have different locations for that). – user160274 Oct 14 '15 at 16:40
1

Windows uses the %APPDATA% directory for user specific application configuration files. The %PROGRAMDATA% folder is used for system wide application configuration files, though it appears that Windows Store apps may not be able to use %PROGRAMDATA%.

The registry is a hierarchical database included as part of Windows that can also store some config data as key-value pairs.


For Mac OS X, the ~/Library folder is usually used, with /Library for global configs.

Usually these are nested further, so your preferences would go in ~/Library/Preferences/ and some other files would go in ~/Library/Application Support


Note that in all of the above cases, you'll probably want to put your configurations under your app's name within the base location.

  • And also the registry, .config files, XML files, INI files, databases, bespoke web services etc etc etc. – Robbie Dee Oct 14 '15 at 16:18
  • What do you mean by "the registry"? I'm a bit confused. Otherwise, good answer. – user160274 Oct 14 '15 at 16:21
  • @RobbieDee Added the registry as you were commenting. .config files, XML files, INI files, and databases are all storage formats, not locations. Web services I'll leave to someone else to talk about. – 8bittree Oct 14 '15 at 16:22
  • @Jamen The registry is a central configuration storage on windows which you could use instead of configuration files. I recommend using it only where necessary. – CodesInChaos Oct 14 '15 at 16:25
  • 1
    My point was the "appropriate place" has differed vastly over the many versions of windows there has been. – Robbie Dee Oct 14 '15 at 16:34