February 5th, 2018
Apple bundles a command-line tool with Xcode, agvtool, to automatically update your project’s version and build numbers. This article shows you how to use agvtool in your Xcode projects.
Before you can use agvtool, you must tell Xcode to use it for your project. To enable agvtool, change the following build settings:
Because agvtool is a command-line tool, you have to run it from the Terminal application. Navigate to your project’s directory before running agvtool.
The most common thing you will be doing in agvtool is incrementing the build number. Run agvtool with the
next-version -all option to increment the build number.
agvtool next-version -all
To set the build number to a specific value, supply the desired build number. The most common reason for explicitly setting a build number is to use non-integer build numbers. The following example sets the build number to 8.2:
agvtool next-version -all 8.2
what-version option lets you see the current build number.
To update the version number of your project, run agvtool with the
new-marketing-version option and supply the version number. The following example sets the version to 0.5:
agvtool new-marketing-version 0.5
what-marketing-version option lets you see the current version number.