Auto-increment Build Number in Xcode

Aug 23, 2013 · Follow on Twitter and Mastodon xcode

When I released new version of iOS apps, I used to manually update the build number. It is however better to let Xcode do it automatically. Let’s take a look at how to do it.

Counter

When looking for ways to automate bumping the build number in Xcode, I found this great script that automatically increments the build number each time you build the app.

The original script will increment the build number by one each time. I prefer to have a date stamp, so I can see when a build was performed. I therefore use the yyyymmddHHMM format when bumping the build number of my apps.

To make this work, I replaced the default buildnum value with this one:

buildnum=`date +%Y%m%d%H%M`

This will set the build number to a timestamp instead of incrementing it by one.

Initially, Xcode may have problems executing your script. For this to work, you will need to enable run access. Do so by running the following script from the Terminal:

sudo chmod 755 'filename'

Execute it in the same folder as the shell script, and you should be good to go.

Discussions & More

Please share any ideas, feedback or comments you may have in the Disqus section below, or by replying on Twitter or Mastodon.

If you found this text interesting, make sure to follow me on Twitter and Mastodon for more content like this, and to be notified when new content is published.

If you like & want to support my work, please consider sponsoring me on GitHub Sponsors.