Skip to content

Instantly share code, notes, and snippets.

@mingsai
Created October 22, 2013 18:57
Show Gist options
  • Save mingsai/7106123 to your computer and use it in GitHub Desktop.
Save mingsai/7106123 to your computer and use it in GitHub Desktop.
Below is a simple bash script that uses the PlistBuddy executable on MacOSX to generate an auto increment versioning script. To use: Open Xcode 5 Select Project > Build Phases Click Menu: Editor > Add Build Phase > Add Run Script Build Phase Click into White Text Box Below Run Script and Paste Contents of Gist
#!/bin/bash
# Auto Increment Version Script
buildPlist=$INFOPLIST_FILE
echo $buildPlist
CFSVString=$(/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$buildPlist")
CFBundleVersion=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$buildPlist")
BUILD_NR=${CFBundleVersion##*.}
BUILD_NR=$(($BUILD_NR + 1))
#echo $BUILD_NR
CFBundleVersion=$CFSVString".0."$BUILD_NR
#echo $CFBundleVersion
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $CFBundleVersion" "$buildPlist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment