How to add version and copyright info to a file in MacOs

971 views Asked by At

I am building an executable in GoLang for MacOs. I need to add version and copyright information to the built file. How do I do this during the go build process or afterwards?

For example the iBooks application has this information enter image description here

P.S. I usually build for Windows only where I use Versioninfo format to add file properties but cannot find something equivalent for MacOs

1

There are 1 answers

1
Oliver Jackman On

iBooks is an application bundle, not a single binary like you would build with go. So you would need to find a way of wrapping the go binary in an app bundle in order to get this detail, and if it was applicable to your executable.

If you right click on the iBooks icon and then select "Show Package Contents", then navigate into the Contents folder you will find (among other files+folders) an Info.plist file and a version.plist file which hold the definition of the copyright and version respectively.

Info.plist

...
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2013–2018 Apple Inc. All rights reserved.</string>
...

version.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>BuildAliasOf</key>
    <string>iBooks</string>
    <key>BuildVersion</key>
    <string>1</string>
    <key>CFBundleShortVersionString</key>
    <string>1.14</string>
    <key>CFBundleVersion</key>
    <string>1458.15</string>
    <key>ProjectName</key>
    <string>iBooks</string>
    <key>SourceVersion</key>
    <string>1458015000000000</string>
</dict>
</plist>