Auto Increment Your Build Numbers

If you're like me you probably get tired of manually incrementing your app build number in Xcode. After a few hours of testing I finally nailed down a simple solution that works on Xcode 13.2.1. Let's dive right in.

Note: I like to increment the build number after a successful archive, but you may want to do it before the archive or (unlikely) before each Xcode build. Here are the steps to auto increment the build number after successful archives:

  1. Open your scheme settings (Product > Scheme > Edit Scheme [or] click your scheme in the top bar and then click Edit Scheme [or] shift + command + ",")
  2. Expand the Archive settings
  3. Click Post-actions
  4. Click the "+"
  5. Click New Run Script Action
  6. Make sure "Provide build settings from ..." is set to your target (the script needs access to the project directory variable)
  7. Paste in this code

cd "${PROJECT_DIR}" ; agvtool bump

It should look something like this:

You're all set! Run an archive build & watch the build number increment across your entire project once the archive completes.



  • You might not have noticed the quotes around ${PROJECT_DIR} - I've seen some solutions that didn't include those &¬†it prevents the process from switching to the correct directory.
  • agvtool is a helper tool that comes with Xcode command line tools. If you don't have the command line tools installed, just open terminal and type xcode-select --install then follow the prompts.