On MacOS, it looks like KPScript is not available (brew, download, etc). However, there is keepassxc-cli.
There should be a keepass abstraction layer to retrieve password, with two implementations depending on operating system:
- Windows/Linux => KPScript
- Mac => keepassxc-cli
My 2 cents.