Skip to content

Instantly share code, notes, and snippets.

@tiagobbraga
Last active September 23, 2025 13:47
Show Gist options
  • Select an option

  • Save tiagobbraga/0e3128ef67603795d78c59c79673936c to your computer and use it in GitHub Desktop.

Select an option

Save tiagobbraga/0e3128ef67603795d78c59c79673936c to your computer and use it in GitHub Desktop.
Increment Build Number with agvtool
To enable agvtool in an Xcode project, follow these steps:
Select your project and target: Open your Xcode project and select your project in the Project Navigator. Then, select the target you want to configure agvtool for.
Access Build Settings: Go to the "Build Settings" tab for your selected target.
Configure Versioning System:
Configure Versioning System:
- Search for "versioning" in the search bar.
- Locate the "Versioning System" setting and change its value to "Apple Generic."
- Ensure "Current Project Version" is set to an integer, typically 1 initially.
Verify Info.plist settings (Optional but recommended):
- Go to the "Info" tab of your target.
- Check that "Bundle versions string, short" (CFBundleShortVersionString) and "Bundle version" (CFBundleVersion) are set to appropriate initial values, such as 1.0 and 1 respectively.
Disable User Script Sandboxing (if using a build phase script):
- If you plan to use a "Run Script" build phase to automatically increment the build number using agvtool, you might need to disable user script sandboxing.
- In the "Build Settings" tab, search for "User Script Sandboxing" and set it to "No".
Create a Run Script Phase (for automatic incrementing):
- Go to the "Build Phases" tab.
- Click the "+" button and select "New Run Script Phase."
- Open the newly created "Run Script" section and paste the desired agvtool command. For example, to increment the build number:
```
xcrun agvtool next-version -all
```
This command increments the build number for all targets in your project.
After completing these steps, agvtool is enabled and configured for your project, allowing you to manage version and build numbers either manually via the command line or automatically through a build phase script.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment