Is it only OS X or are all BSD-based distros bundled with versions of tools such as grep, find, split, etc. that are not as feature-rich as Linux? reddit / BSD ---------------------------------------------------------------------- WalkingOnFire · 2015-10-10 12:54 It's depends if your linux **distribution** uses the GNU tools or busybox or sbase... :) The real answer is that the GNU tools are not designed following the unix philosophy while BSD tools at least they try to not differ much from POSIX. http://harmful.cat-v.org/cat-v/unix_prog_design.pdf ---------------------------------------------------------------------- daemonpenguin · 2015-10-10 13:13 It can depend on the tool. The BSD command line utilities sometimes are missing parameters their GNU counterparts have, but the reverse is also true. The GNU version of "tail", for example, does not support the "-r" reverse flag, while BSD's does. There are lots of examples going both ways. In general though, GNU tools tend to include more options at the risk of introducing non-standard behaviour. ---------------------------------------------------------------------- traxislyte · 2015-10-10 14:47 Modern FreeBSD or OpenBSD will have more options than OS X, but they tend to try to keep to the philosophy of only building it if it is a feature that people in the project agrees really adds to the command line experience. People who use FreeBSD and OpenBSD love being at the command line. OS X is not much different than NeXTSTEP was -- there's POSIX compliance and a largely neglected command line. People who use OS X don't like to be at the command line, and it shows. The Apple idea that everything goes into XML files shuts out command line users, for example. The GNU tools have a lot of obscure and seldom-used switches which sometimes make their way into personal favorites but, especially for beginners, can also really get in the way. ---------------------------------------------------------------------- dwchandler · 2015-10-10 15:07 BSDs contain their own internally maintained versions of the common utility programs, whereas Linux distros typically package up GNU userland tools. The BSDs typically place more emphasis on backward compatibility of those base tools and are more conservative about adding new features. The upside of that is that if you have an old script it'll still work on the newest *BSD release. The downside is that there are some handful of nice things that haven't been implemented. Several years back on the local LUG mailing list someone asked for help with some scripts they had been using for ages that stopped working for them. They had originally written them on UNIX(tm) and then continued to use them under Linux and life was good until they broke. I tested them on OpenBSD and they worked fine. Eventually we found that GNU had changed the default behavior to, IIRC, *sed*. The fixes were easy enough *once we found out where GNU had changed*. ---------------------------------------------------------------------- nanthiel · 2015-10-10 15:42 Especially the man pages take a hit when you add a plethora of options. I smile whenever I think of OpenBSD man pages. I did mess up a few days ago when I ran "usermod -G wheel " in Ubuntu, though. In OpenBSD the -G flag appends the user to the group, but in Ubuntu it sets all the groups (OpenBSD flag -S), so it removed my user from all groups but wheel. And wheel in Ubuntu isn't anything useful, because sudo uses the group "sudo" instead. Yay for single user mode. ---------------------------------------------------------------------- BumpitySnook · 2015-10-10 16:44 It's not just OS X — OS X's tools are mostly old versions of the BSD tools. That being said, they are *old versions*. Sometimes the newer BSD tools have features that match the GNU coreutils/binutils ones, while the OS X tools lag. Typically BSD tools will have less options, especially `--long-form` options, than their GNU counterparts. ---------------------------------------------------------------------- dlangille · 2015-10-10 21:06 What examples do you have of 'not as feature-rich'? ---------------------------------------------------------------------- behrangsa · 2015-10-10 22:02 Why OS X/Darwin do not keep their command line tools up to date with BSD? Also do BSDs have the same problem in respect with bash 4.x? That's are their licenses incompatible such that they can't bundle it with the distros? ---------------------------------------------------------------------- behrangsa · 2015-10-10 22:06 I see. Well yesterday I noticed that split does not support the -n option and grep does not support variable length look behind in OS X. I have encountered similar issues in the past as well. Guess have to live with this for now. --- With `brew` we can [install the GNU version of these tools](http://apple.stackexchange.com/questions/69223/how-to-replace- mac-os-x-utilities-with-gnu-core-utilities/69332#69332). MacPorts had a similar package too AFAICR. ---------------------------------------------------------------------- behrangsa · 2015-10-10 22:08 I gave three examples. Here's another one for you: * http://www.freebsd.org/cgi/man.cgi?locate(1) * http://linux.die.net/man/1/locate ---------------------------------------------------------------------- dlangille · 2015-10-10 22:52 You mentioned apps yes, but I wanted to have examples of what options you are missing. I am willing to help you with FreeBSD but I'm not inclined to read the man pages to compare options for you. You tell me what you're missing, and I might be able to find something which might help you. ---------------------------------------------------------------------- behrangsa · 2015-10-10 23:02 Thanks, but I was not looking for help. I just wanted to know if it is only OS X that has fewer options in many of its command line utils or if all BSD distro have more or less the same problem. ---------------------------------------------------------------------- BumpitySnook · 2015-10-10 23:50 > Why OS X/Darwin do not keep their command line tools up to date with BSD? That's a question for Apple. I can't answer it. > Also do BSDs have the same problem in respect with bash 4.x? That's are their licenses incompatible such that they can't bundle it with the distros? Not sure what you mean: $ pkg info bash | head bash-4.3.39_3 ---------------------------------------------------------------------- dlangille · 2015-10-11 00:54 Problem? ---------------------------------------------------------------------- behrangsa · 2015-10-11 01:31 OS X is still using a very old version of bash: $ /bin/bash --version GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15) Copyright (C) 2007 Free Software Foundation, Inc. Apparently this is due to [the change of bash's license from GPLv2 to GPLv3](http://gplv3.fsf.org/rms-why.html). Using OS X package managers (brew or macports) you can upgrade to a later version of bash, but out of the box, OS X comes bundled with a very old version of bash. ---------------------------------------------------------------------- BumpitySnook · 2015-10-11 06:11 BSDs don't bundle bash in base, so it doesn't matter too much to them. ---------------------------------------------------------------------- ihazurinternet · 2015-10-12 15:53 I had some fun creating a Linux distro with sbase, ubase, musl-libc, and runit. It was an interesting experience. ---------------------------------------------------------------------- yjftsjthsd-r · 2015-10-13 16:03 I've been toying with the idea of doing that very thing; by any chance did you write up the process anywhere? ---------------------------------------------------------------------- ihazurinternet · 2015-10-13 16:41 Unfortunately not, I have thought about it however. I'll write up the process tonight if I get the chance and reply with it. It wasn't as difficult as I'd imagined. ---------------------------------------------------------------------- somercet · 2015-10-13 18:00 That would be interesting. ---------------------------------------------------------------------- nubatamano · 2015-10-17 15:24 For example, GNU awk has the FPAT functionality. ---------------------------------------------------------------------- nubatamano · 2015-10-17 15:31 I broke mpd on one of my Arch systems with this exact mistake recently. I guess the safe way to do this is with gpasswd ---------------------------------------------------------------------- sigzero · 2015-10-18 18:54 The license changing is probably it. The installed zsh version on OS X is only a couple minor revs behind.