Skip to content

Instantly share code, notes, and snippets.

@benvium
Created October 15, 2015 08:06
Show Gist options
  • Select an option

  • Save benvium/b78bc7ceceb4ac6b01ee to your computer and use it in GitHub Desktop.

Select an option

Save benvium/b78bc7ceceb4ac6b01ee to your computer and use it in GitHub Desktop.
Script to update the build number stored in the plist file for an iOS project
#!/bin/sh
#
# SETUP INSTRUCTIONS
#-----------------------
#
# Add this file to a folder called 'scripts' at the same level as your xcodeproj file
# Open XCode
# Select Project on left-hand view
# TARGETS / your target
# Select 'Build Phases'
# Add Run Script phase BEFORE 'compile sources'
# P
plist=$1
buildnum=$(/usr/libexec/Plistbuddy -c "Print CFBundleVersion" "$plist")
if [ -z "$buildnum" ]; then
exit 1
fi
buildnumplus=$(expr $buildnum + 1)
/usr/libexec/Plistbuddy -c "Set CFBundleVersion $buildnumplus" "$plist"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment