About the date command being different on Mac

Mac seems to be based on BSD Unix, and there is some difference from GUN Linux commands.
So, I'm talking about putting GNU commands into Mac.
To be honest, I've only noticed date and xargs so far, but...

Just to put the difference in perspective...

BSD-style date command

# 1 day ago
date -v-1d

The GNU-style date command

# 1 day ago
date -d '-1 day'

So, to install the GNU-style commands on your Mac, you can use

brew install coreutils

You can do this by running
I thought this should change the date command, but the installed command has a "g" prefix, so you need to define an alias with an alias (like gdate)
So, define an alias in the .bashrc file.

# In my environment
alias date='/usr/local/bin/gdate'

Now you can use the GNU-style date command.

en_USEnglish