Linux (GNU) vs. Mac (BSD) Command Line Utility Differences
If you switch between Mac and Linux often you notice that certain command line utilities are sometimes slightly different…
For example the date
command on linux:
Outputs the date while on mac:
Gives the above syntax error. On Mac you would need to write:
Alternatively you could install coreutils package which will add the
some packages specifically the date
utility under the gdate
command. As this
StackOverflow
answer says you can install other GNU utilities on Mac using Homebrew:
As you use CLI utilities you’ll notice small differences such as with xargs
on mac
the --no-run-if-empty
or -r
flag doesn’t exist because as this StackOverflow
answer says the BSD xargs command doesn’t automatically run even if no args are passed.
See the BSD man(ual) pages and the GNU man(ual) pages. This post gives a good overview and comparison of GNU vs. BSD.