I'm trying to add a value to my Info.plist
inside a Build Phase Run Script:
/usr/libexec/PlistBuddy -c "Add :BuildDate date `date`" "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}"
# For debugging:
cat "${BUILT_PRODUCTS_DIR}/${INFOPLIST_PATH}" | grep BuildDate
This works (as proven by the cat
), but it seems the result is almost immediately overwritten afterwards, by some other Xcode build step.
Is it simply not possible to modify the Info.plist
in the Build Phase? I've seen numerous suggestions around the web to do exactly that.
I assume you're trying to modify the Info.plist
(and not a plist.info
as I don't know what that is).
It's absolutely possible to create, modify, or delete the Info.plist
during the Build Phase. However, you need to do so before the build process needs to make use of Info.plist
. The exact timing of this varies, but the earlier the better - I'd recommend doing so right after the Dependencies step.
I have a sample Xcode project that does this for a macOS app and a macOS Command Line Tool. It's considerably more complicated than what you're likely trying to do, but it might be helpful to take a look and see how it's configured.