What is a quick way to exit a program in the OSX terminal?
press control + C in your keyboard.
and in some man-page and vim editor write
:q and press enter.
Try pressing Ctrl-c.
As they pointed out, you can press control+C in almost any terminal application
In OS X, you can additionally press command+.