The default installed commands, such as date, may not be compatible with general Linux systems.
$ date -d '+10 minutes' +%s
date: illegal option -- d
usage: date [-jnRu] [-I[date|hours|minutes|seconds]] [-f input_fmt]
[-r filename|seconds] [-v[+|-]val[y|m|w|d|H|M|S]]
[[[[mm]dd]HH]MM[[cc]yy][.SS] | new_date] [+output_fmt]To resolve this, install coreutils:
brew install coreutilsNext, add the following line to either ~/.zprofile or ~/.bash_profile:
export PATH="/opt/homebrew/opt/coreutils/libexec/gnubin:$PATH"Afterward, the command should work as expected:
$ date -d '+10 minutes' +%s
1683467946brew install gnu-sedexport PATH="/opt/homebrew/opt/gnu-sed/libexec/gnubin:$PATH"brew install grepexport PATH="/opt/homebrew/opt/grep/libexec/gnubin:$PATH"brew install findutilsexport PATH="/opt/homebrew/opt/findutils/libexec/gnubin:$PATH"brew install gnu-timePATH="/opt/homebrew/opt/gnu-time/libexec/gnubin:$PATH"
alias time='/opt/homebrew/opt/gnu-time/libexec/gnubin/time'or use TIMEFMT
export TIMEFMT=$'\n\n========================\nProgram : %J\nCPU : %P\nuser : %*Us\nsystem : %*Ss\ntotal : %*Es\n========================\n'brew install makePATH="/opt/homebrew/opt/make/libexec/gnubin:$PATH"brew install gzip
which