Comment by mdasen

1 year ago

I'd say that you care about it being UNIX-like, not UNIX®. You don't care that Linux isn't UNIX. You don't care that GNU versions of things like ed and awk are slightly off-spec.

In some ways, Apple's adherence to UNIX specifications probably makes macOS less useful for you. For example, I wish that grep on macOS was closer to GNU grep. When I look up commands online, I often find answers based on the GNU implementations. Those often work on macOS, but sometimes don't (or have subtly different behavior) because macOS is adhering to the UNIX specification rather than to what those utilities do on the vast majority of systems out there.

I don't think Apple would be removing UNIX-like tools from macOS even without certification. They know how valuable it is that most developers use their systems. Even Microsoft went so far as to implement the Windows Subsystem for Linux for developers. At this point, I think that UNIX certification makes macOS less compatible with the tools and help out there which generally targets Linux. Usually the differences are small, but they certainly can be meaningful.

> I don't think Apple would be removing UNIX-like tools from macOS even without certification. They know how valuable it is that most developers use their systems.

I hope you're right but I'm not as confident. Corporations - Apple included - have been guilty of some surprising ignorance when it comes to things like this. I'm thankful for this certification circus to continue so that we don't need to test your theory.

  • Yeah, except Apple dogfoods macOS to build most of the software for Macs and everything else they make. Presumably they rely on UNIX-like tools and would have to retool as well. So why mess with what’s working for them and others?

> In some ways, Apple's adherence to UNIX specifications probably makes macOS less useful for you. For example, I wish that grep on macOS was closer to GNU grep. When I look up commands online, I often find answers based on the GNU implementations. Those often work on macOS, but sometimes don't (or have subtly different behavior) because macOS is adhering to the UNIX specification rather than to what those utilities do on the vast majority of systems out there.

UNIX certification is not the reason why macOS utilities are missing options compared to GNU - UNIX standards say you have to have certain options which work a certain way, they don’t prohibit adding additional options as vendor extensions. The reason is that Apple’s investment in improving these tools is minimal because it is a low priority for them, and because people who get annoyed by this often just end up installing the GNU tools anyway (using Homebrew or MacPorts)

In fact, GNU/Linux systems have been certified as UNIX in the past, by a couple of different Chinese vendors (Inspur K-UX, Huawei EulerOS)-which shows use of the GNU tools is no inherent obstacle to certification. The reason these vendors stopped, I suspect, is the money it was making them was smaller than the certification costs and UNIX trademark license fee

  • Pretty sure GNU coreutils really does intentionally deviate from POSIX compliance in a handful of places, otherwise POSIXLY_CORRECT wouldn't exist. That said you're probably right, though I also suspect dealing with GPL licensing is another major reason they don't bother with things like GNU coreutils. (Obviously they definitely wouldn't have done it after coreutils switched to GPLv3, but I'm sure even before then they would've greatly preferred permissively-licensed software.)

    • There is some subtlety that you are missing here.

      Outside of coreutils, let's consider bash and ksh88.

      The two have differing behavior in several areas (coprocesses, alias handling, final pipeline fork, etc.), but this divergence in behavior happened before POSIX.2 and the standardization of the POSIX shell, which is largely a subset of ksh88.

      The gist is that activating a mode for POSIX compliance will generally remove functionality, because the standardization happened a decade after development began, and the standards themselves were excessively conservative in adherence to System V.

      I've seen that useful GNU extensions are generally adopted by BSD, but much more slowly by POSIX.

      That does not serve UNIX well. Someone should challenge the Austin Group for effective control of UNIX standardization.

      9 replies →

    • > Pretty sure GNU coreutils really does intentionally deviate from POSIX compliance in a handful of places, otherwise POSIXLY_CORRECT wouldn't exist.

      To get UNIX certification, you can just patch it to make POSIXLY_CORRECT=1 the default.

      Or even don’t patch the utilities, and just patch /etc/profile to set POSIXLY_CORRECT=1 globally.

      UNIX certification requires that the system have a mode of operation available which passes the test suite; the existence of config settings which if changed from their defaults produce standards violations is not in itself a standards violation.

      1 reply →

  • Apple got spooked by GPL v3 anti-tivoization clauses and stopped updating GNU tools in 2007.

    macOS still has a bunch of GNU tools, but they appear to be incompatible with GNU tools used everywhere else, because they're so outdated.

    • And Apple is doing a lot of Tivoization these days. They're not yet actually stopping apps that they haven't "notarized" but they're not making it easier. One of the many reasons I left the Mac platform, both private and at work. The other reason was more and more reliance on the iCloud platform for new features (many of its services don't work on other OSes like Windows and Linux - I use all those too)

      The problem with the old tools is that I don't have admin rights at work so it's not easy to install coreutils. Or even homebrew.

      I can understand why they did it though. Too many tools these days advocate just piping some curl into a root shell which is pretty insane. Homebrew does this too.

      2 replies →

> I'd say that you care about it being UNIX-like, not UNIX®.

Right, but I think GP's point is that if Apple didn't feel pressured to get macOS UNIX-certified, then they wouldn't even bother to be UNIX-like. That is, all sorts of UNIX-required command-line tools would start to disappear from the default install, and things like POSIX conformance would take a back-burner, etc.

Not sure if I agree with that, but that's what GP seems to be suggesting.

> For example, I wish that grep on macOS was closer to GNU grep.

This has nothing to do with UNIX conformance; this just comes from macOS's BSD background, which does not use the GNU core utils. If the Linux folks wanted to go through UNIX conformance testing, they wouldn't have to switch away from GNU tools. And macOS could swap out the BSD-sourced tools for GNU tools and still get their UNIX certification.

Built-in grep is thankfully not as odd as the builtin find is. Might be the first one I replace on my systems.

Some Linux distros have gotten certified. I assume they have released necessary patches as required by GPL.

  • I don't think any patches are required. It's literally just a matter of going through the certification dance for the average distro.

    • There are patches required. Many GNU utilities are very close to the UNIX spec, but not quite the UNIX spec - including glibc. But making a Linux distro that is UNIX certified would likely make it a worse Linux distro for most people since it would be less compatible with what everyone is assuming for a Linux distro. A lot of the differences are subtle edge cases, but do you really want that in your distro?

      It's not just about going through a song-and-dance. It's about making an OS that has different behavior - often very tiny differences, but differences that would make the distro worse for most users.

      2 replies →

brew install grep?

  • brew is such a treasure.

    • and kind of a counter point to the GGGP's "Unix compliancy isn't what's keeping me on macOS, the Unix tools it has under the hood still is."

      I certainly replace a large chunk of the "unix tools under the hood" with tools installed via homebrew.

> because macOS is adhering to the UNIX specification

Isn’t it rather that Darwin was based on BSD 4.4? I’d imagine GPL 3.0 is a bigger impediment to them ever migrating to GNU tools than any desire to be UNIX certified.

  • https://developer.apple.com/library/archive/documentation/Da...

    It derives from 4.4 BSD but it's more than that.

    macOS includes a woefully outdated bash 3.2 due to GPL 3.0; they switched to zsh long ago.

    • I know. My question is, isn’t the reason the command line tools work the way they do simply that they’re essentially the BSD programs (give or take an Apple patch), with BSD options, not because they needed to work that way for Apple to get the OS certified?

      Even if macOS wasn’t UNIX-certified, Apple would still be unwilling/unable to include the GNU software due to the license. I can’t see the Apple of today implementing a full suite of non-GNU software but with GNU-style options either.

      So, POSIX compliant or not, there’s probably no world where `grep -P` works out of the box on a Mac.

      1 reply →