For what it may be worth, here's how I access the calibre-debug on MacOS. Once you had cded to the MacOS directory, you need to use ./ before the command you want to run (by default, most Linux/Unix shells do not look in the current directory). I've never used the KPF to KFX conversion so can't say if that will actually work.
Code:
Last login: Mon Oct 9 20:47:45 on console
david@Davids-Mac / % cd /Applications/calibre.app/Contents/MacOS/
david@Davids-Mac MacOS % ls
calibre calibre-parallel ebook-convert ebook-polish lrfviewer
calibre-complete calibre-server ebook-device ebook-viewer lrs2lrf
calibre-customize calibre-smtp ebook-edit fetch-ebook-metadata markdown-calibre
calibre-debug calibredb ebook-meta lrf2lrs web2disk
david@Davids-Mac MacOS % ./calibre-debug
Welcome to the interactive calibre shell!
Use exit to quit
>>> exit
david@Davids-Mac MacOS %