I’m completely new to macOS development, this might sound quite basic.
I need to distribute a Golang app for macOS.
I built the Go executable for macOS, the executable works fine on macOS.
I made its .app structure following this tutorial
But before distributing it, I need to do a few things like code signing & integrating Sparkle (for updates).
For that, I need to open this .app as a Xcode project. How do I do that ?
Xcode recognizes .xcodeproj extension
I created a sample Xcode Objective-C project but how do I get this project to run my executable/.app ?
You do not need to open the app as an Xcode project – that doesn’t make sense as such and cannot be done, as the app is not an Xcode project.
I would suggest instead using the
gon tool you can find here for code signing.
The easiest way to install it is usually through HomeBrew by running:
brew tap mitchellh/gon brew install mitchellh/gon/gon
The above requires you to have HomeBrew installed in advance.
After installing, you create a
config.json file as described on the
gon GitHub page, and then run:
That will sign, zip, notarize and staple your application for you – creating a
.dmg file for distribution.
In regards to Sparkle for easily updating your program, this is something you have to integrate into your Go program. You can find an example of how to do that here.
The example contains a simply Objective-C function
sparkle_checkUpdates() that uses the Sparkle framework to invoke the updating mechanism. It also contains a Go function
sparkle_checkUpdates() that use C imports to call that C function described before.
In your existing Go program, you just need to call that
sparke_checkUpdates from somewhere when the user wants to check for updates.
Answered By – jksoegaard
Answer Checked By – Marilyn (GoLangFix Volunteer)