Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to release a macos app written with flutter

I have a flutter app which I built in Flutter for macOS. But I cannot figure out a way to codesign the Application.app package. I have searched the internet and couldn't get a proper way to do it.

like image 375
Jude Osbert K Avatar asked Feb 02 '20 10:02

Jude Osbert K


People also ask

Can Flutter be used for macOS?

macOS supports developing Flutter apps for iOS, Android, macOS itself and the web. Complete at least one of the platform setup steps now, to be able to build and run your first Flutter app.

Does Apple allow Flutter apps?

Flutter is a multi-platform application development framework that enables you, among other platforms, to develop iOS and Android apps from the same source code. However, you need to use Xcode to build an iOS app and Xcode will only work on macOS.


2 Answers

The procedure is very simple. But it's not properly documented anywhere.

  1. Get a certificate from Xcode. The simplest step is to use Xcode, add a new certificate. Read more about it here https://help.apple.com/xcode/mac/current/#/dev154b28f09
  2. Once you have the certificate you need to find the identity for it to sign your app . security find-identity -p codesigning run this in terminal and copy hash it gives you against the certificate name you just created.
  3. build the release version of your flutter app by running flutter build macOS in your project folder UPDATE flutter build macOS doesn't work any more. Try flutter build macos instead. Refer. Thank you @Bartosz for pointing it out in comments.
  4. cd into the folder where your app is created. now run codesign --deep --force --verbose --sign "<identity>" Application.app Supply the hash we coped in step 2 in place of (Keep the quotes).

You should see something like this Application.app: signed bundle with Mach-O thin (x86_64) [com.application]

  1. Verify the signature codesign --verify -vvvv Application.app and spctl -a -vvvv Application.app

First one will give you something like

Application.app: valid on disk
Application.app: satisfies its Designated Requirement

Second one will give you something like

Application.app: accepted
source=Developer ID
origin=Developer ID Application: Spreaker Inc (xxx)

Read more about it https://pracucci.com/atom-electron-signing-mac-app.html

Flutter Desktop is wonderful. But coming from an Android Dev background, I had no idea how to sign in mac. Hope it helps someone.

like image 121
Jude Osbert K Avatar answered Oct 17 '22 22:10

Jude Osbert K


You can simply set your signing identity in the Xcode project, using the UI or an xcconfig, as with any standard macOS application. There's nothing Flutter-specific about the signing process.

like image 40
smorgan Avatar answered Oct 17 '22 23:10

smorgan