PlistBuddy in macOS in BuildSettings


I used the code there to register our custom URI Let Your OS X Desktop App React to Custom URIs – Xojo Programming Blog

It was working for a while since we implemented it but I just found that it’s no longer working for my app or maybe I do something bad.
There is nothing written in the Info.plist anymore

Here is the code for my App in the build settings, it’s coming right after the Build step,
This script applies to Both (Release and Debug) and on Any architecture

Dim appPath As String = CurrentBuildLocation + "/" + CurrentBuildAppName +".app"
call DoShellCommand("/usr/libexec/PlistBuddy -c ""add :CFBundleURLTypes array"" " + appPath + "/Contents/Info.plist")
call DoShellCommand("/usr/libexec/PlistBuddy -c ""add :CFBundleURLTypes:0 dict"" " + appPath + "/Contents/Info.plist")
call DoShellCommand("/usr/libexec/PlistBuddy -c ""add :CFBundleURLTypes:0:CFBundleURLName string 'Laby'"" " +appPath + "/Contents/Info.plist")
call DoShellCommand("/usr/libexec/PlistBuddy -c ""add :CFBundleURLTypes:0:CFBundleURLSchemes array"" " + appPath + "/Contents/Info.plist")
call DoShellCommand("/usr/libexec/PlistBuddy -c ""add :CFBundleURLTypes:0:CFBundleURLSchemes:0 string 'laby'"" " + appPath + "/Contents/Info.plist")

When I try to extract (manually) the command and enter them in iTerm, it’s working fine but not through the Build settings.

/usr/libexec/PlistBuddy -c "add :CFBundleURLTypes array" /Users/julien/Documents/Sources/laby/
  • Is there a way to print to the system log the output of the command executed in the build setting?
  • Is using defaults prefered over PlistBuddy?
  • Am I doing something wrong?

Xojo: 2022r1
macOS: 11.5.1

Thank you,


Take off the + ".app" part of that statement. CurrentBuildAppName has been changed to include that.

In addition, rather than using Call for each of those statements, I would be inclined to check the return status of each function call and report any errors.

Thank you, it solved the issue.

I will also try to handle errors and check return code.

Maybe the blog post can be updated to apply changes @Dana_Brown ?

This line was extracted from an App Wrapper script and shared so much in the forums (without and indication as to where it came from), that it has become standard it seems.

You do realize that these plist settings and other can all be configured in App Wrapper’s GUI, saving the hassle of having to figure out how to make it work, while at the same time it helps with all the other preparation needed to distribute Mac apps on the App Store or online?

Yes I do realize it but we have no need to use it for now. We got some easy script setup and it’s work fine for the moment.