4 ms·
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
by mdasen 1y 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.
- cesaref 1y agobrew install grep?
- Avamander 1y agoBuilt-in grep is thankfully not as odd as the builtin find is. Might be the first one I replace on my systems.
- pseudocomposer 1y agoGiven that both grep and find are weird/inconsistent between BSD/GNU versions, and I typically use them piped together for the same things anyway, I’ve found that ripgrep is a nice/faster/universal alternative that is pretty unproblematic to install in whatever environment I want: https://github.com/BurntSushi/ripgrep https://github.com/BurntSushi/ripgrep
- iknowstuff 1y agoAnd also fd https://github.com/sharkdp/fd https://github.com/sharkdp/fd
- bawana 1y agoBut isnt that what AI is for? Writing syntactically correct regexes?
- mechanicum 1y ago> 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.
- p_ing 1y agohttps://developer.apple.com/library/archive/documentation/Darwin/Conceptual/KernelProgramming/Architecture/Architecture.html 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.
- mechanicum 1y agoI 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.
- p_ing 1y agoSure, much like ping and tracert are BSD programs on Windows, just with a few different options that are OS-specific. There's no reason to include GNU anywhere. I don't know why Apple would.
- lucideer 1y ago> 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.
- avidphantasm 1y agoYeah, 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?
- zeckalpha 1y agoSome Linux distros have gotten certified. I assume they have released necessary patches as required by GPL.
- pxc 1y agoI don't think any patches are required. It's literally just a matter of going through the certification dance for the average distro.
- swiftcoder 1y agoDon't you have to ship the BSD-compatible versions of grep et al?
- pxc 1y agoI'm not sure why you would. I don't think POSIX generally specifies the behavior of command line tools in such a level of detail. FWIW, the regex type used by default by GNU Grep is already POSIX's Basic Regular Expressions. (It also supports POSIX Extended Regular Expressions and PCRE2.) Afaik, EulerOS and other Unix-certified Linux distros just ship the usual GNU userland.
- mdasen 1y agoThe Single UNIX Specification does specify the behavior of many command line tools like ed, grep, awk, etc. OpenBSD sometimes notes where their tools vary from the UNIX spec. It's usually very small ways that don't matter to most people, but it does put them outside of the UNIX spec.
- swiftcoder 1y agoPOSIX != Unix. Unix certification does require POSIX, but it also comes with a bunch more stringent requirements
- pxc 1y ago
- skissane 1y ago> 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
- jchw 1y agoPretty 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.)
- skissane 1y ago> 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.
- kelnos 1y ago> 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.