Registry / devops / codemagic-cli-tools

codemagic-cli-tools

JSON →
library0.69.0pypypi✓ verified 25d ago

Codemagic CLI Tools is a collection of command-line utilities designed to simplify Android and iOS app builds, code signing, and deployment. These tools power the codemagic.io CI/CD service but can also be used locally or in other CI/CD environments. The library is currently at version 0.64.0 and sees active development with frequent releases addressing new features, bug fixes, and compatibility updates, often tied to Xcode and App Store Connect changes.

pip install codemagic-cli-tools
INSTALL
IMPORT
SIG · CODEMAGIC-CLI-TOOL
C
codemagic-cli-tools
devopspythonv0.69.0
Install
6.6s avg
Import
2279ms
Disk
189MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.69.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 2.398s · 189.6MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 6.6s · import 2.160s · 190MB
189MB installed
● package 189MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Keychain
from codemagic.tools import Keychain
The library provides a Python API mirroring the CLI tools, accessible via `codemagic.tools`. This example shows how to import the `Keychain` tool for programmatic use. Other tools like `AppStoreConnect` are similarly available.

This quickstart demonstrates how to set up environment variables for App Store Connect API keys and then use the `app-store-connect fetch-signing-files` CLI command. This command is crucial for managing iOS code signing assets, such as provisioning profiles and certificates. Securely providing credentials via environment variables is a common and recommended practice.

import os # Set required environment variables for App Store Connect API key # Replace with your actual Issuer ID, Key Identifier, and a path to your .p8 private key file # It's recommended to load these from a secure source (e.g., CI/CD secrets) in production. os.environ['APP_STORE_CONNECT_ISSUER_ID'] = os.environ.get('APP_STORE_CONNECT_ISSUER_ID', 'YOUR_ISSUER_ID') os.environ['APP_STORE_CONNECT_KEY_IDENTIFIER'] = os.environ.get('APP_STORE_CONNECT_KEY_IDENTIFIER', 'YOUR_KEY_IDENTIFIER') os.environ['APP_STORE_CONNECT_PRIVATE_KEY_FILE'] = os.environ.get('APP_STORE_CONNECT_PRIVATE_KEY_FILE', '/path/to/AuthKey_YOUR_KEY_IDENTIFIER.p8') # Example CLI command: Fetch iOS signing files # This command attempts to fetch or create provisioning profiles and certificates # for a given bundle ID from App Store Connect. # NOTE: In v0.64.0, default save locations changed (see warnings). cmd = ( "app-store-connect fetch-signing-files " "--issuer-id $APP_STORE_CONNECT_ISSUER_ID " "--key-id $APP_STORE_CONNECT_KEY_IDENTIFIER " "--private-key @file:$APP_STORE_CONNECT_PRIVATE_KEY_FILE " "com.example.yourapp" ) print(f"Running command:\n{cmd}") # In a real script, you would use subprocess.run(cmd, shell=True, check=True) # For quickstart, we just print the command as direct execution requires setup. # import subprocess # try: # result = subprocess.run(cmd, shell=True, check=True, capture_output=True, text=True) # print("STDOUT:\n", result.stdout) # print("STDERR:\n", result.stderr) # except subprocess.CalledProcessError as e: # print(f"Command failed with error: {e}") # print("STDOUT:\n", e.stdout) # print("STDERR:\n", e.stderr)
codemagic-cli-tools --version
Debug
Known issues
breakingAs of v0.64.0, the default directories for saving downloaded certificates and provisioning profiles have changed. `--certificates-dir` now defaults to `~/Library/Developer/Xcode/UserData/Certificates` and `--profiles-dir` to `~/Library/Developer/Xcode/UserData/Provisioning Profiles` for the `app-store-connect` and `keychain` tools. This change aligns with Xcode 16.0+ behavior. Existing build scripts relying on older default locations may break or save files to unexpected paths.
fix
Explicitly specify `--certificates-dir` and `--profiles-dir` arguments if your scripts depend on specific file paths, or update your build environment to expect the new default locations.
affects: >=0.64.0
gotchaPrior to v0.62.0, the `app-store-connect publish` action might have silently succeeded even when `altool` (Apple Transporter) encountered errors during the app upload process. This could lead to misleading successful build statuses.
fix
Upgrade to v0.62.0 or newer to ensure `app-store-connect publish` correctly fails when `altool` reports errors, providing more reliable feedback on upload status. Check `altool` output carefully if on older versions.
affects: <0.62.0
gotchaThe tools heavily rely on correctly configured App Store Connect API Keys (Issuer ID, Key ID, Private Key) or Google Play Service Account credentials for authentication with Apple and Google services. Incorrect setup of these environment variables or missing permissions often leads to authentication failures and build issues.
fix
Double-check that `APP_STORE_CONNECT_ISSUER_ID`, `APP_STORE_CONNECT_KEY_IDENTIFIER`, `APP_STORE_CONNECT_PRIVATE_KEY_FILE` (or `GOOGLE_PLAY_SERVICE_ACCOUNT_CREDENTIALS`) are set correctly and that the API key has the necessary 'App Manager' permissions for App Store Connect. Use `@env:` or `@file:` prefixes for sensitive values.
affects: All versions
deprecatedThe `android-app-bundle bundletool-version` action was deprecated.
fix
Use `android-app-bundle bundletool version` instead.
affects: >=0.61.0
Errors
Common errors & fixes
Did not find xcodeproj from /Users/builder/clone/ios
Codemagic is unable to locate the Xcode project file (`.xcodeproj`) in the expected directory, often due to a non-standard project structure or a monorepo setup where the project is nested deeper than assumed by default scripts.
fix
Explicitly specify the path to your main `.xcodeproj` file using the `--project` argument in your `xcode-project` commands within your `codemagic.yaml` workflow. For example: `xcode-project use-profiles --project ios/MyProject.xcodeproj`.
Failed to set code signing settings for apps/responder-app/node_modules/react-native-fast-image/ios/FastImage.xcodeproj
In projects like React Native, Codemagic's `xcode-project use-profiles` command might incorrectly attempt to apply code signing settings to `.xcodeproj` files of dependencies located within `node_modules` instead of your main application's Xcode project.
fix
Modify your `xcode-project use-profiles` command to explicitly target your main application's `.xcodeproj` file, preventing it from processing dependency projects. For example: `xcode-project use-profiles --project ios/YOUR_PROJECT_NAME.xcodeproj` or `xcode-project use-profiles --project ios/*.xcodeproj`.
❌ error: Provisioning profile "CodeMagic" doesn't include the com.apple.developer.associated-domains entitlement.
The provisioning profile used for code signing is missing a required entitlement (e.g., Associated Domains, Push Notifications) that is enabled in your Xcode project or required by your app's capabilities, or there's a mismatch between the bundle identifier in the profile and the project.
fix
Log in to your Apple Developer account, navigate to 'Certificates, Identifiers & Profiles', edit the relevant provisioning profile to add the missing entitlement(s), ensure the correct bundle identifier is used, then download and re-upload the updated profile to Codemagic. Alternatively, ensure the capability is enabled for your App ID in the Apple Developer Portal.
Unable to load bundle identifiers Loading bundle identifiers for OMTecnologiaParaNegocios11 failed. A required agreement is missing or has expired.
The App Store Connect API key being used to interact with Apple services is encountering an issue where a required agreement in your Apple Developer account has not been accepted or has expired. This prevents Codemagic CLI tools from accessing necessary information like bundle identifiers.
fix
Log in to your Apple Developer account on App Store Connect and review the 'Agreements, Tax, and Banking' section to accept any pending agreements or renew expired ones.
codemagic-cli-tools: command not found
The `codemagic-cli-tools` package is either not installed, or its installation directory is not included in your system's PATH environment variable, preventing the shell from finding the executable.
fix
Install the tools using pip: `python3 -m pip install codemagic-cli-tools`. If already installed, ensure your PATH environment variable includes the directory where pip installs executables (e.g., `~/.local/bin` on Linux/macOS or Python's Scripts directory on Windows). You might also need to restart your terminal.
Upgrade
Version history
0.69.0latest on PyPI · released Jul 15, 2026
Audit
Dependencies
pythonrequiredRequired to run the tools.
Agent activity
13 hits · last 30 days
node
10
Resources
codemagic-cli-tools — pip install codemagic-cli-tools · libregistry