Dynamic Patching on Mac OS X

Back in the Old Times, when Macs still used PowerPC processors, I worked on desktop management software that needed to override core system functionality, for example disabling a menu item in Internet Explorer or Safari, or intercepting print commands to perform cost accounting. I ultimately worked out a way to inject code into other processes (we were running as root after all) and then patch any…