Hacker News new | ask | show | jobs
by kdmccormick 1083 days ago
Well, I look at the POSIX standards whenever I want to write shell scripts and Makefiles that work on both Linux and macOS. Which, in my current role, is often enough that I am driven crazy by how far POSIX is behind GNU tooling...
1 comments

Yep. Funny enough, Linux is actually not POSIX certified

POSIX was initially a bunch of the Unix vendors getting together in the 80s seeing a rise of incompatibility saying "this shit is crazy let's find something we can agree on" and then the conflicts of trying to still have a differentiating But Also compatible product. They knew that if they cannibalized themselves, IBM Novell and DEC were there to snatch up the customers

As a result, POSIX was intentionally kneecapped by all the players but not enough to make it completely worthless.

By the 2010s I decided to simply ignore it and if something breaks on FreeBSD or whatever, make the decision then whether to support it or not. Mostly it's platform testing at the top and then subbing the gnu version of things and bailing out if it's not there.

Got it. I'm the dev tools guy at my job right now, and we have a mix of Linux and Mac users, so I've gotta make sure that any shell I write works on both. For me, POSIX seems to be a good indicator of the intersection between the two OSs, even though the true intersection is neither a superset nor subset of POSIX (eg, Mac has bash, which isn't POSIX shell). Oh well. It's close enough to be useful, and I test it all manually anyway.
Mac OS ships zsh since 10.15 as default shell as I'm sure you know, with the (restricted ksh subset called) POSIX shell pretty much the intersection of what works on both Linux and Mac OS. There you have the usefulness of POSIX/SUS.