Skip to content

Instantly share code, notes, and snippets.

@Ariandr
Created May 17, 2018 10:07
Show Gist options
  • Select an option

  • Save Ariandr/033ac61fde405b180d866b385d95642c to your computer and use it in GitHub Desktop.

Select an option

Save Ariandr/033ac61fde405b180d866b385d95642c to your computer and use it in GitHub Desktop.
Adding the automated script for incrementing a build number
#In your Xcode target project settings select the "Build phases" tab.
#Click the "+" button add select "New Run Script Phase"
#In the script area paste this tiny script which will increment the bundle version every time the project is built:
#!/bin/bash
# This script takes the build number from the release target plist, increments and then saves back
bN=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "${PRODUCT_SETTINGS_PATH}")
bN=$(($bN + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $bN" "${PRODUCT_SETTINGS_PATH}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment