Some macOS installations include the Unix realpath command and some do not. I haven't been able to discern an accurate pattern of which versions have it.
I'm on an M1 Air with Monterrey 12.6 and Xcode 13.4.1 and I do not have it. (I am also not using Homebrew.) I also don't have access to any other Macs.
I'm trying to find out whether this realpath resolves Apple's new "firmlinks" which are a feature of the APFS filesystem.
An example of a firmlink is /System/Volumes/Data/Applications which links to /Applications
To test your system you can enter these commands in your Terminal:
which realpathrealpath /System/Volumes/Data/Applications
(Note that the ls command does not report firmlinks no matter what switches you use.)