Global keyboard input cocoa

I’ve been having some trouble receiving global keyboard input on cocoa. Does anyone have some advice on how this could be done, preferably with an example?

I’ve tried NSEventMonitorMBS with pretty much 0 success. I just need a way to receive key down and key up events no matter which program has focus. It was a snap on Windows but I’m very unfamiliar with Apple.

I think I was tired yesterday. I’d spent so long slamming my head against this brick wall of a problem that I failed to see the answer. A solution lies with the CarbonMonitorEventsMBS class: