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

  • Home
  • SEARCH
  • 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 6787479
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:22:16+00:00 2026-05-26T17:22:16+00:00

I have created a Command Line Utility C++ tool in XCode using Objective-C. I

  • 0

I have created a Command Line Utility C++ tool in XCode using Objective-C. I want the version number to be displayed in the Info of the created executable. So I have added the version number 1.0.0.0 in the Current Project Version field in the Build settings. However, when I build it, the version number does not get added to the created ‘Unix Executable File’.

Am I missing something?
Thanks for the help.

  • 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-26T17:22:17+00:00Added an answer on May 26, 2026 at 5:22 pm

    Unfortunately, Xcode will not embed the current project version into the executable by itself, as of version 3. I’m not sure if this has changed in Xcode 4.

    I ran into this problem a couple of years ago. It turns out that:

    1. Version numbers displayed in the Finder come from applications’ Info.plists. In the case of an application bundle, Info.plist is a file. In the case of an executable, it must be embedded in a __TEXT section. The format of the Info.plist is the same either way.

    2. Xcode does not have one-click support for embedding Info.plists into executables, but it is possible.

    3. Xcode doesn’t preprocess Info.plist files unless they’re going into an application bundle (e.g. to insert the value of CURRENT_PROJECT_VERSION).

    I hacked up a solution, but it’s unpolished and probably doesn’t represent best practices.

    First, I created a new, stock Info.plist file called Info_template.plist. I set CFBundleVersion to ${CURRENT_PROJECT_VERSION}, and CFBundleShortVersionString to ${CURRENT_MARKETING_VERSION}.

    Then, I added a Run Script phase called “Preprocess Info.plist” at the beginning of the build, using /bin/sh as the shell, with this script:

    set -u
    
    if ! [[ ${CURRENT_PROJECT_VERSION:-""} && ${CURRENT_MARKETING_VERSION:-""} ]]; then
        echo "Version numbers are not set" >&2
        exit 1
    fi
    # Ghetto environment variable expansion, since Xcode does not appear to have built-in expansion for arbitrary files
    { echo "cat <<EOF"
      cat ${SRCROOT}/Info_template.plist
      echo "EOF"
    } | sh > ${DERIVED_FILES_DIR}/Info.plist
    

    I added $(DERIVED_FILE_DIR)/Info.plist to its output files.

    Then, I opened the target’s build settings, and added this to Other Linker Flags:

    -sectcreate __TEXT __info_plist ${DERIVED_FILE_DIR}/Info.plist
    

    This asks the linker to roll the generated Info.plist file into the executable.

    Let me know how this works for you, or if I left anything out!

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

Sidebar

Related Questions

I have created a simple hello world application in xcode using the command line
I have an existing utility application, let's call it util.exe. It's a command-line tool
I have created one table using the below command: create table Table1( Id int
I have created a certificate using the following SSL command: makecert -r -pe -n
I have a command line utility from a third party (it's big and written
I have created a file named ab.sql using the mysqldump utility of a database
I have command line utility written in ANSI C on a Mac with a
I have created a program that prints results on command line. (It is server
I need a custom command-line task in my grails app, so I have created
I have created a function that takes a SQL command and produces output that

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.