Last Updated: February 25, 2016
·
1.552K
· milancermak

How to auto-increment build numbers in Xcode

To set up auto-incrementing of build numbers in Xcode, go to the project scheme (⌘+<), click on the grey arrow next to your Build target and put these three lines as the pre-action script:

CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$SRCROOT/$INFOPLIST_FILE")

CFBundleVersion=$(($CFBundleVersion + 1))

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "$SRCROOT/$INFOPLIST_FILE"

Now hit ⌘+B and watch the magic happen.