> For the complete documentation index, see [llms.txt](https://t1t.gitbook.io/trust1connector-packaging/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://t1t.gitbook.io/trust1connector-packaging/mac-os/create-a-mac-os-trust1connector-api-package.md).

# Create a Mac OS Trust1Connector API package

This page will describe the steps to create a Mac OS API package.

## Prerequisites

For creating a package we need the following components:

* A device running Mac OS
* `XCode`: <https://developer.apple.com/xcode/>
* `wget`: Install using `brew` (<https://brew.sh/>): `brew install wget`
* `unzip`: Install using `brew` (<https://brew.sh/>): `brew install unzip`
* `packages`: Install packages (<http://s.sudre.free.fr/Software/Packages/about.html>)
* An Apple Developer account

{% hint style="warning" %}
Internet access towards Google cloud storage environment is a requirement, see the introduction for more information
{% endhint %}

## Step 1: Preparation

for the first step make sure all assets are updated for your version, environment and naming (application naming, installation folder, logos, ...). For this you can look at [Mac OS introduction](/trust1connector-packaging/mac-os/mac-os-introduction.md)

`application.conf` is a file that needs to be provided by Trust1Team. We will need the following information to create a valid `application.conf`;

* Distribution service URL
* Distribution service Public key
* Domain of the Trust1Connector (t1c.t1t.io) -- this needs to map to localhost
* SSL certificate of the Trust1Connector domain -- Trust1Team will put this in a keystore

`t1c.conf` needs to be updated with a valid API key for the specified version and environment.

## Step 2: Apple Developer Application Bundle ID & Certificates

![](https://3863024646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEbp4mycln2YdxX9Gg5%2F-MHGDJlL0qaVdFhCP6At%2F-MHGDq8IRJ2xM22EOudx%2FScreenshot%202020-09-14%20at%2010.06.09.png?alt=media\&token=65713906-09ba-4382-9dc9-4c06b82234c8)

You should create 3 new application identifiers. The names may be chosen freely but the identifiers **must** follow the package naming convention, being the reverse organisation domain name + application name in lowercase, e.g. `com.t1t` as reverse organization domain and `t1c` as application name. The component identifier values following this may not be altered:

1. **`*.api`**: The Trust1Connector API application identifier.
2. **`*.api.dialog`**: The Trust1Connector OS dialog application identifier.
3. **`*.grpc`**: The Trust1Connector Sandbox application identifier.

The package also needs to be updated in all the following scripts;

* post\_install.sh
* pre\_install.sh
* uninstall.sh
* installer.pkgproj -> update com.t1t.t1c. entries to desired package
* api\_Info.plist
* grpc\_Info.plist
* \*.api.plist -> rename to {package}.api.plist
* \*.grpc.plist -> rename to {package}.grpc.plist

And in the `package.sh` you need to update the `PACKAGE_NAME`&#x20;

The certificates for `Developer ID Application` and  `Developer ID Installer` should be imported in your login keychain

![](https://3863024646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEbp4mycln2YdxX9Gg5%2F-MHGDJlL0qaVdFhCP6At%2F-MHGiYOEdsbcZE7pb1D8%2FScreenshot%202020-09-15%20at%2014.25.20.png?alt=media\&token=f4c15b38-f39c-48e7-b8d3-de0f9c9989fd)

The certificate private key access control should also be set to allow access to all applications prior to creating the package.

![Right click the private key and select 'Get Info'](https://3863024646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEbp4mycln2YdxX9Gg5%2F-MHGDJlL0qaVdFhCP6At%2F-MHGiMjuYfK_S0PpZFEH%2FScreenshot%202020-09-15%20at%2014.22.51.png?alt=media\&token=2420dae3-49a3-4b1c-b84a-e3548d473c46)

![On the 'Access Control' tab, select 'Allow all applications to access this item' and save your changes](https://3863024646-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MEbp4mycln2YdxX9Gg5%2F-MHGDJlL0qaVdFhCP6At%2F-MHGilSyEtFAu2VyCrpB%2FScreenshot%202020-09-15%20at%2014.23.07.png?alt=media\&token=8f77bb70-e714-484f-82e5-365b0a6bc68c)

## Step 3: Packaging Script

the file `1_FULL_PACKAGE.sh` in the folder `/_mac` is everything you need to create your package. It will fetch all needed resources from the cloud and copy all resources needed from the local repository to create an `dmg` installer.

### Signing

Do not forget to update the sign command to your desired method.

For MacOS this is more envolved, you need to update the developer settings found [below](/trust1connector-packaging/mac-os/create-a-mac-os-trust1connector-api-package.md#step-4-execute-the-script).\
Make sure if you update the package name all the scripts are updated.\
Make sure the steps [above](/trust1connector-packaging/mac-os/create-a-mac-os-trust1connector-api-package.md#step-2-apple-developer-application-bundle-id-and-certificates) are also executed.

## Step 4: Execute the script

{% hint style="warning" %}
Be sure to update the `package.sh` script with the proper credentials
{% endhint %}

```bash
DEV_ACCOUNT=""
DEV_PASSWORD=""
DEV_TEAM=""
```

The credentials above should be filled accordingly.

| Property      | Description                                               |
| ------------- | --------------------------------------------------------- |
| DEV\_ACCOUNT  | The password for the Apple developer account              |
| DEV\_PASSWORD | The team ID mentioned in the Apple Developer certificates |
| DEV\_TEAM     | The e-mail associated with your Apple developer account   |

Execute the bash script with the appropriate arguments for your package.&#x20;

### Creating the package

#### Arguments

The arguments are in a fixed order and must all be provided:

| Parameter         | Description                                                                                            |
| ----------------- | ------------------------------------------------------------------------------------------------------ |
| Customer          | name of the customer configuration folder in which to retrieve the scripts and assets (lowercase)      |
| environment       | The package installer's environment. Can be `dev`, `acc`, or `prod`.                                   |
| Keychain password | The password for the current user's keychain, in which the Apple developer certificates were imported. |

| Parameter                | description                                                                                                                                                                 |
| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Release Version          | Version of the release used to determine which folders to look into                                                                                                         |
| API Version              | Version of the T1C API will most of the time be the same as release version, but you will be notified should this diverge when we communicate the release of a new version. |
| Environment              | The package installer's environment. Can be `dev`, `acc`, or `prod`.                                                                                                        |
| Keychain Password        | The password for the current user's keychain, in which the Apple developer certificates were imported.                                                                      |
| Customer Name            | name of the customer configuration folder in which to retrieve the scripts and assets (lowercase)                                                                           |
| Application Name         | The application name, can contain upper- or lowercase characters, but **must** not contain any whitespaces                                                                  |
| Package Name             | The package name. This value **must** be the value configured in step 2.                                                                                                    |
| Apple Developer Account  | The e-mail associated with your Apple developer account                                                                                                                     |
| Apple Developer Password | The password for the Apple developer account                                                                                                                                |
| Apple Developer Team     | The team ID mentioned in the Apple Developer certificates                                                                                                                   |

#### Example

```bash
./1_FULL_PACKAGE.sh trust1team dev {{password}}
```

&#x20;This process may take a while to complete, especially the notarisation and stapling process at the end.
