Perforce on mac and Xcode - Automatically Checking Out Files for Edit in Xcode

Is there anyone out there who use Perforce source control with a C++ project on an Apple mac and Xcode ?
If so, how do you handle the checking out of files? Do these scripts for Xcode 5 still work?

Well, I just tried it myself and the code doesn’t seem to work anymore (Xcode 15.4).

Finally managed to get it to work. There is a newer version of this script on Github.

Make sure you have the p4 command line tool installed and the Perforce environmental variables are set on your mac as well as in the script.