Live data from Hacker News

macOS dotfiles should not go in –/Library/Application Support

becca.ooo

181–190 of 223 posts

Re: macOS dotfiles should not go in –/Library/Application Support

#181
post #104

Earlier quoted context omitted.

> they refuse to see it this way That's why the long-term future of app development is containers. It is not possible, on a human level, to convince people to lift even the lightest of fingers for the common good. Consider https://specifications.freedesktop.org/basedir-spec/latest/ The XDG specification has been around for 22 years. It has real benefits for users. It's trivial to implement. Yet even in the year of ou…

> The XDG specification has been around for 22 years. Indeed! > It has real benefits for users. I once believed this! > It's trivial to implement. Nope! I ranted about this a while back ( https://bsky.app/profile/str4d.xyz/post/3lsjbnpsbh22i ) but the tl;dr is that the XDG specification is imprecisely written and internally inconsistent, and there has been confusion since at least as early as 2003 about what kind of…

I'm confused.

$XDG_CONFIG_HOME is clearly meant for data that would otherwise be in a configuration style dotfile. This is the sort of configuration that that users may well want to sync between machines such that a dotfile manager should include them by default. (That said, there may be some data from some of the other XDG directories worth syncing too, but generally a dotfile manager should not include those other folders in full by default.)

Beyond that the spec defines $XDG_DATA_HOME as "base directory relative to which user-specific data files should be stored.". The default path ($HOME/.local/share) might suggest that this should be read-only data, but it actually is read-write.

The description of the $XDG_STATE_HOME makes it quite clear that $XDG_DATA_HOME read-write: "The $XDG_STATE_HOME contains state data that should persist between (application) restarts, but that is not important or portable enough to the user that it should be stored in $XDG_DATA_HOME". This makes it clear that important and portable data should be written to $XDG_DATA_HOME.

And thus we also have $XDG_STATE_HOME. The list of examples that follow the previously quoted sentence make it clear that this is stuff that gets persisted, but if it were omitted from a backup, the user will probably not care too much (i.e. stuff like logs, history, set of open files, undo history, etc.

$CDG_DATA_HOME does also include any read-only reference data, which should be searched for there, and in $XDG_DATA_DIRS (which defaults to "/usr/local/share/:/usr/share/").

It could certainly be argued that read-only reference data and read-write user data should not have been mixed. After all Unix does keep them separate that at the top level `/var` vs `/usr/share`, but the spec authors apparent felt this distinction was not necessary at the user level.

Re: macOS dotfiles should not go in –/Library/Application Support

#182

Earlier quoted context omitted.

Regardless of the default value, I think we can all agree that supporting XDG_* would be a good start!

Can't you just std::env::var it? Why need a library? It's not even set on my MacBook though.

Yeah, the variable is usually unset, so you’ll want to have a default value in your code. Basically something like

  config_dir="${XDG_CONFIG_HOME:-$HOME/.config}/my-app"
Of course, if you decide to account for Windows / macOS conventions, it’ll be a bit trickier, but pulling in a library for that is a bit overkill, yeah.

Re: macOS dotfiles should not go in –/Library/Application Support

#183

~/. for Darwin, ~/Library/Application Support for macOS. That simple.

That sounds like a good distinction.

What are CLI tools that work under macOS but not under Darwin? Shortcuts like `code` or `pycharm` that open graphical apps? CLI tools that come bundled with macOS? Yeah these could use the latter.

Re: macOS dotfiles should not go in –/Library/Application Support

#184
post #25
post #18

Earlier quoted context omitted.

(I maintain a fairly popular TUI library), and as a CLI/TUI user on macOS, I dislike the App Support folder a lot. But even though I dislike it, I'd expect that apps for mac should put their files there because the XDG spec doesn't apply to macOS. It's the wrong place, but the technically correct one. The right thing to do is fix the spec, and then fix the apps / libs to follow that. I wrote a top level thread that t…

And I’d also argue that the App Support folder doesn’t apply to CLI/TUI config files either. Apple doesn’t force CLI programs it distributes from storing files in App Support. If this were the case, wouldn’t you also expect the .ssh folder to be relocated from $HOME to App Support on a Mac? Much like the original author, my opinion is that you should do the least surprising to the user and if that’s not what the spec…

Maybe it's because it's not their programs and they want to pull from upstream?

Re: macOS dotfiles should not go in –/Library/Application Support

#185

Earlier quoted context omitted.

I don’t think it’s unreasonable to be demanding when this refusal negatively affects a lot of other rust software

It's not an official package. Developers of other Rust software can always build the same functionality on their own or fork.

But the effect trickles down to many end users

Re: macOS dotfiles should not go in –/Library/Application Support

#186

Earlier quoted context omitted.

To the best of my knowledge, it's incorrect to store anything other than plists in that directory. And if you're writing a cross-platform application, it's not necessarily correct to have a completely different file format on different OSes. Not all Windows applications should store all their preferences in the registry, either.

> Not all Windows applications should store all their preferences in the registry, either. I'd honestly be fine if none of them did.

Agree. Registry is a fuck.

Re: macOS dotfiles should not go in –/Library/Application Support

#187

I disagree with this. macOS isn't Linux, and as much as I _absolutely support_ the XDG BaseDir spec, I don't think it's fair to try and apply it to macOS. Linux has no 'proper' directory for storing configuration, cache and application user data. macOS and Windows _do_. It's only proper to support those systems in the way that they intend. I wouldn't put stuff in to `%HOME%\.config` on Windows any more than I would p…

> Why would macOS get bundled in with Linux? Because it's a unix? That's silly. I'm somewhat on the fence about this topic in general & I think you've hit upon why. This isn't silly. At all. Linux & Mac environments are by no means compatible but for anyone who cares about the location of their dotfiles, the two systems have demonstrably been "compatible enough". To the point that having coordinated standards on some…

> Though the flip side of my own subjective take here is that "home directory dotfile vomit" has just never seemed as big an issue to me as many make out.

This is a fair take, and something that I've considered when going down the obsessively organized path.

Does it _ultimately_ matter? No, of course not. A file is a file is a file and if it's located in $HOME or $HOME/.config is immaterial to the OS and, generally, a program. Just so long as it can be read and written to is ultimately what _matters_.

However. Insofar as directories are a construct for humans to mentally parse out and organize data that may be just abstractly written to any number of non-consecutive sectors on a disk, _I'd_ like to at least have a clean mental image of "where" that data is. Apparently, enough people had that same idea and started the excellent XDG spec.

> This isn't silly. At all.

I will grant you that it's pedantic. Both are POSIX-esque systems and to a large degree, talk the same way and expose the underlying infrastructure in a similar manner. However, I think ignoring the platform's preferred organizational methodology is doing a disservice to the end user. If the user wants a vomit of hundreds of . files in their home directory, fine, I'm not your mom. You do you, but I think you should follow the law of least surprise and put things where they're _supposed_ to go, first, then if over-riden, then follow the user.

> but Windows isn't a monolith

It is the very definition of said. There is only one version of Windows, and any marketing faff about different editions are just different coats of paint on the same underlying system. Windows is Windows. You don't have Windows on ARM supporting %HOME%\.datadir\local\system\noreally instead of "AppData". You have AppData and that's it. You can bank on it being the same across all versions of Windows that are still in production, even going back a long way.

WSL1/2 are bolt ons that should behave differently. They're emulating a foreign system, configuration should be stored within, to whatever specification that happens to be.

Re: macOS dotfiles should not go in –/Library/Application Support

#189
post #150

I disagree with this. macOS isn't Linux, and as much as I _absolutely support_ the XDG BaseDir spec, I don't think it's fair to try and apply it to macOS. Linux has no 'proper' directory for storing configuration, cache and application user data. macOS and Windows _do_. It's only proper to support those systems in the way that they intend. I wouldn't put stuff in to `%HOME%\.config` on Windows any more than I would p…

> Linux has no 'proper' directory for storing configuration, /etc ? > cache /var/cache, /var/tmp ? > and application user data. /var ?

It's a stretch to say /var is for application _user_ data. For a certain value of "user" sure, like MariaDB or Redis. They're "users", and have data in /var but it's a non-interactive session.

User data is stored in the user's $HOME, of which none of those locations are, generally, writable to an end-user, and wouldn't be a place to permanently store that data.

Re: macOS dotfiles should not go in –/Library/Application Support

#190

Earlier quoted context omitted.

[flagged]

It's unkind to publicly speculate on this in this particular way, IMO.

Kindness is reciprocal, IMO. But I will concede speculation is unproductive.
Post reply on HN