Pew AAAA Mac OS
When building a .NET Core application that will run on Mac you might want to distribute it outside from Mac App Store. In this article, I will provide a step by step guide on how to package and notarize a .NET Core application to achieve distribution.
- Manually Remove Win32/wacapew.C!ml on Mac OS (Some of the steps will likely require you to exit the page. Bookmark it for later reference.) Step 1.Quick malicious process. Click the Go button and select Utilities folder; Locate the Activity Monitor icon on the screen and double-click on it.
- From the Apple menu in the corner of your screen, choose About This Mac. You should see the macOS name, such as macOS Big Sur, followed by its version number. If you need to know the build number as well, click the version number to see it. Which macOS version is the latest?
Even though the Mac OS has a /etc/resolv.conf file it does not seem to be used; rather, the OS has its own way of DNS resolution and scutil -dns lets you see what is configured. (I am very very sketchy on the details and to be honest I didn’t make much of an effort to figure out the details either).
Pew Aaaa Mac Os Catalina
Let’s Start!
For this guide, I created a simple .NET Core Console application that outputs “Hello World”. Now let’s go step by step:
1. Publish app as self-contained
We use the following command in Terminal to publish for macOS:
By publishing the app as self-contained it produces a macOS 64-bit executable.
If you created the application on Windows, make sure to run chmod +x AppName (Path to unix executable) from a Unix machine. Otherwise, the app will not start on macOS. To create an app bundle there are several ways to achieve this:
You can find more information about this here.
2. Create an app bundle
To create an app bundle there are several ways to achieve this you can follow this awesome guide or use a tool that generates it. For this sample, I’m using Platypus which provides a graphical user interface for creating a Mac Application bundle based on a shell script.
1) In the Platypus Script Path
Create a new script with the following:
APP_NAME is the name of your application Unix executable file
In the specific case of this sample the script content is:
2) Fill the following information:
– App Name: Name of the application
– Icon: Application icon
– Identifier: Bundle identifier of the application
– Author: Author of application
– Version: The version number of application build
3) Add all files that were generated when the app published as self-contained (including the Unix executable) to Platypus bundled files.
4) Click on Create App
Voila!
But there’s a problem if we open the generated app bundle in other Mac we will get the following result:
To avoid this we need to notarize the application that brings us to our next step.
3. Create a Developer ID Application
To be able to distribute outside of the Mac App Store we need to use a Developer ID Application certificate.
4. Use the notarization script
I created a bash script called app_notarizer.sh that allows you to do the following:
- Create a notarization request
- Check notarization request status
- Staple the notarization to your app.
Script Requirements:
- XCode
- Apple Id Account app-specific Password (https://support.apple.com/en-us/HT204397)
- Apple Developer ID Application Certificate created and installed in Keychain Access (https://developer.apple.com/support/developer-id/)
By using this script you can notarize the application by following these steps:
1) Create a notarization request
2) Check notarization request status
3) Once notarization status comes as successful, staple notarization
For information on the script:
Create a notarization request:
Notarization request is created by executing the following command:
For this sample, I used this App.entitlements file. you can find more information on entitlements here.
Pew Aaaa Mac Os X
If successful we get a response similar to this one :
We will use the RequestUUID (39d40f6e-510b-497f-9edd-92ac4e128e54 ) to check the status in the next step.
Pew Aaaa Mac Os Download
Check notarization request status
We can check the notarization request status by using the following command:
It might take a few minutes to change from processing to approved or invalid. But if approved here is the response we get:
Also should receive an email:
If you get invalid as status or run into any other issue please check: https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution/resolving_common_notarization_issues
Staple notarization
Finally, we need to staple the notarization to the application.
We can do it with the following command:
Now we can successfully distribute our .NET Core console application!
Special thanks to Lorenzo Araujo who helped me create this amazing script.
You can find the source code and notarization script of this sample here.
Happy macOS Notarization!
References