OS X Debugging¶
As of MATLAB 2015b you cannot use a more recent Xcode version than 6.4 (this is of course a moving target). Using Xcode 7 will not work yet. The gmt-mex subversion project will check out an Xcode project called gmtmex.xcodeproj located in the src/xcode directory. After installing the older Xcode (I did so in /Applications/OldXcode) and selecting it (sudo xcode-select --switch /Applications/OldXcode/Xcode.app; you can switch back giving the path to /Applications/Xcode.app) you can start the old Xcode and open the project file. Note: The project assumes you have installed a GMT 5.2.x distribution in /opt/gmt. Click the Build button (Triangular arrow) and it should build the executable gmtmex in the build/Debug sub-directory. I suggest adding the full path to this directory to the paths you have listed in MATLAB's startup.m file. To debug, select a line to stop in the gmtmex.c code, start MATLAB, pull down Xcode's Debug→Attach to Process menu and find the MATLAB process. Now run your gmt.m command in MATLAB and the code should stop at your stop point. Normal debugging follows.
Some (older) resources that were helpful in getting us this far: