In Xcode, updating a project version couldn’t be easier. Just head over to the Info section of the target settings and modify the Version and Build fields:

Setting target build and version number in Xcode 11

There are other situations which may require some form of automation for this process. For example, when working continuous and build integration tools or when the project contains multiple targets.

agvtool

The agvtool is a command-line tool that allows you to automatically increment or update the Version and Build number of a project or target.

Getting started

First, we need to configure the project to use Apple Generic Versioning. Note: this can be done both on target or project level.

Using agvtool

Now, from the command-line we can execute commands to retrieve or update the project and target versions:

$ xcrun agvtool what-version
$ xcrun agvtool what-marketing-version
$ xcrun agvtool new-version -all 1
$ xcrun agvtool new-marketing-version 1.116

The agvtool also supports scenarios to automatically determine the “next” version as well as other configuration options. More information is of course availablie in the docs.