Some commands are identical on macOS and GNU/Linux, but they behave differently, e.g., readlink and sed. We can install GNU version commands via Homebrew, all commands are installed with the prefix g by default, e.g., greadlink and gsed.
brew install coreutils provides:
greadlinkgrealpath- etc.
brew install gnu-sed provides: gsed