DEV Community

Cover image for Install p12 Certificate on the CI/CD's macOS executor
Kyle Foo
Kyle Foo

Posted on

3

Install p12 Certificate on the CI/CD's macOS executor

Here I give an example for CircleCI, in a step prior to using the certificate, let's say for code-signing, make sure you have installed the certificate on your macOS executor, otherwise you may get error while executing code signing.

See sample commands below for your reference:

  sign-app-on-macOS:
    macos:
      xcode: 15.2.0
    resource_class: macos.m1.medium.gen1
    steps:
      - run:
          name: Download and install P12 certificate on macOS
          command: |
            aws s3 cp s3://bucket/certificates/Certificates.p12 Certificates.p12
            security create-keychain -p "password" ci.keychain
            security default-keychain -s ci.keychain
            security unlock-keychain -p "password" ci.keychain
            security import Certificates.p12 -k ci.keychain -P $CSC_KEY_PASSWORD -T /usr/bin/codesign
            security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "password" ci.keychain
            security find-identity -p codesigning -v
     - run: codesign --deep blah blah ...
Enter fullscreen mode Exit fullscreen mode

Steps are as followed:

  1. Download Certificates.p12 from cloud store
  2. Create keychain and import certificate into it
  3. Verify installed certificate that's valid

Note that CSC_KEY_PASSWORD environment variable is set for importing the password protected cert.

Do your career a big favor. Join DEV. (The website you're on right now)

It takes one minute, it's free, and is worth it for your career.

Get started

Community matters

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay