P.S. This patch also contains the mac_check_bundle code I was playing around with to get emacs from the command line to start the GUI.