3 ms·
macOS grep is from FreeBSD, at least as of macOS Mojave (10.14). (Source code for 10.14 might be at https://opensource.apple.com/source/text_cmds/text_cmds-99/g
by wahern 6y ago
macOS grep is from FreeBSD, at least as of macOS Mojave (10.14). (Source code for 10.14 might be at https://opensource.apple.com/source/text_cmds/text_cmds-99/grep/grep.c.auto.html https://opensource.apple.com/source/text_cmds/text_cmds-99/g....) Not sure if it was ever GNU grep. Maybe before the big purge in 2011?
IME, most of the basic shell commands are either directly from FreeBSD or a project in the BSD universe. For example tar is from libarchive, a distinct project (see https://github.com/libarchive/libarchive https://github.com/libarchive/libarchive) that DragonflyBSD, FreeBSD, NetBSD, and macOS import and track. (But oddly not OpenBSD, which has evolved the 4.4BSD-Lite implementation.)
According to a 2012 accounting at http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/ http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/ (via https://news.ycombinator.com/item?id=3559990 https://news.ycombinator.com/item?id=3559990), macOS was down to 16 GPL packages in macOS 10.12 from 47 in macOS 10.5.
- danieldk 6y agomacOS grep is from FreeBSD, at least as of macOS Mojave (10.14). Yep, it still is. On Big Sur on M1: $ grep --version grep (BSD grep) 2.5.1-FreeBSD
- spijdar 6y agoYeah, I'm just an idiot. I guess I was just thinking of GNU make. On the other hand, it looks like (at least on Catalina?) it ships with GNU diffutils, so patch, cmp, diff are all GNU utilities. I'm going to sheepishly pretend like this proves my point somehow :-)