Auto Incrementing Build Number Script for XCode 4

An Auto Incrementing Build Number script that will increment each time your project is built. This is awesome for TestFlightApp which is highly dependent on build numbers for the versions you push to your beta testers. Please be aware that for or services like Crittercism and Flurry, you should turn off auto incrementing build numbers when launching your app. It is best to setup different Targets that will differentiate between Test Build, Beta Build and Release Build.

The script below is an adaptation from Imthiaz Blog. Another good script is by JEFF LAMARCHE

# Auto Increment Version Script
buildVersion=$(/usr/libexec/PlistBuddy -c "Print CFBuildVersion" $buildPlist)
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBuildNumber" $buildPlist)
buildNumber=$(($buildNumber + 1))
builddate=$(date +"%y.%m.%d %H:%M:%S")
/usr/libexec/PlistBuddy -c "Set :CFBuildNumber $buildNumber" $buildPlist
/usr/libexec/PlistBuddy -c "Set :CFBuildDate $builddate" $buildPlist
#/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildVersion.$buildNumber" $buildPlist
#/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString $buildVersion.$buildNumber" $buildPlist

You can increment the bundle version numbers or create your own inside your App’s plist.


  1. kickinespresso posted this