Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7437829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:27:34+00:00 2026-05-29T10:27:34+00:00

In Xcode, I want to set the project bundle version to the git hash,

  • 0

In Xcode, I want to set the project bundle version to the git hash, to create a unique link between a revision and a build.

(I have seen several postings about this that increase the build number for each build, but to me this seems excessive, and I would like to have a build number that testers can refer to when sender feedback).

I added the following as a Run Script in Build Phases:

/usr/libexec/PlistBuddy -c "Set :CFBundleVersion `git rev-parse --short HEAD`" *.plist

And then I read out the bundle version in the code with:

[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];

However, then the new revision number does not appear in the code until the next build. I assume this is because the plist file is already read by the compiler when my script is run.

Also, since the plist is changed with the revision string after committing to git, this causes an annoying diff in the project, so maybe I am not so smart after all.

An alternative would be to write the revision number to a text file (build.txt) which is ignored by git. But I would still like the project build number to follow git as well.

Anyone know a brilliant way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T10:27:35+00:00Added an answer on May 29, 2026 at 10:27 am

    https://gist.github.com/966838 is a short bash script that meets Apple’s requirement that CFBundleVersion should be a monotonically increased string.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Background: I have Xcode 3.2.3 installed and want to distribute a project, ideally to
I'm using XCode 4, and in my project build settings, I've set : Preprocessor
I want to be able to launch a Run Script Build Phase in XCode
I have a mac (runs OS X Lion), when I create XCode projects, there
I want to move to the new XCode 3.2.3 GM Seed build for development,
I have an Xcode project. The project currently has four targets, and I am
When I open an existing iPad project in Xcode and Build and Run it,
So let's say you want to build the Boost Getting Started examples and link
Anyone want to share an Xcode project that has MGTwitterEngine in it? Mine won't
Suppose I have a view derived class named MyView. In the same Xcode project

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.