Install the OCM CLI
This guide walks you through installing the OCM CLI and configuring the necessary credentials.
Install the OCM CLI
You can install the latest release of the OCM CLI from any of the following sources.
Bash
To install with bash for macOS or Linux, execute the following command:
curl -s https://ocm.software/install.sh | sudo bashUsing Homebrew
# Homebrew (macOS and Linux)
brew install open-component-model/tap/ocmFor more information, refer to the OCM CLI package on Homebrew and the Homebrew documentation.
Using Nix (with Flakes)
# Nix (macOS, Linux, and Windows)
# Ad hoc cmd execution
nix run github:open-component-model/ocm -- --help
nix run github:open-component-model/ocm#helminstaller -- --help
# Install development version
nix profile install github:open-component-model/ocm
# Or release <version>
nix profile install github:open-component-model/ocm/<version>
# Check installation
nix profile list | grep ocm
# Optionally, open a new shell and verify that cmd completion works
ocm --helpFor more information, refer to the Nix documentation: Nix flakes.
From AUR (Arch Linux User Repository)
# If not using a helper util
git clone https://aur.archlinux.org/ocm-cli.git
cd ocm-cli
makepkg -iFor more information, refer to the OCM CLI package on AUR and the AUR Documentation.
Using Docker / Podman
podman run -t ghcr.io/open-component-model/ocm:latest --helpFor more information, refer to the Podman documentation.
Build and Run It Yourself
podman build -t ocm .
podman run --rm -t ocm --loglevel debug --helpor interactively:
podman run --rm -it ocm /bin/shYou can pass in the following arguments to override the predefined defaults:
GO_VERSION: The golang version to be used for compiling.ALPINE_VERSION: The alpine version to be used as the base image.GO_PROXY: Your go proxy to be used for fetching dependencies.
Please check hub.docker.com for possible version combinations.
podman build -t ocm --build-arg GO_VERSION=1.22 --build-arg ALPINE_VERSION=3.19 --build-arg GO_PROXY=https://proxy.golang.org .On MS Windows
Using Chocolatey
choco install ocm-cliFor more information, refer to the OCM CLI package on Chocolatey and the Chocolatey documentation.
Using winget
Deprecated: Please note, winget packages are no longer provided. Any existing packages are still working, but no new packages are built and published to winget repository.
Build It From Source
Prerequisites
You need the following tools installed:
Installation Process
Clone the open-component-model/ocm repo:
git clone https://github.com/open-component-model/ocmEnter the repository directory (cd ocm/) and install the cli using make:
make installPlease note that the OCM CLI is installed in your
go/bindirectory, so you might need to add this directory to yourPATH.
Verify the installation:
ocm versionConfigure the OCM Command Line Client
Credentials to be used by the OCM CLI can be configured by supplying it with a
configuration file. By default, the CLI looks for the file in $HOME/.ocmconfig.
Prerequisites
- Obtain access to an OCM repository. This can be any OCI registry for which you have write permission (e.g., GitHub Packages). An OCM repository based on an OCI registry is identified by a leading OCI repository prefix. For example:
ghcr.io/<YOUR-ORG>/ocm.
Using the Docker Configuration File
The easiest way to do this is to reuse your Docker configuration json file.
Create a file named .ocmconfig in your home directory with the following content:
type: generic.config.ocm.software/v1
configurations:
- type: credentials.config.ocm.software
repositories:
- repository:
type: DockerConfig/v1
# The path to the Docker configuration file
dockerConfigFile: "~/.docker/config.json"
propagateConsumerIdentity: true
- type: attributes.config.ocm.software
attributes:
cache: ~/.ocm/cacheUsing Basic Authentication
Alternatively, you can use basic authentication. Create a file named .ocmconfig in your home directory with the following content:
type: generic.config.ocm.software/v1
configurations:
- type: credentials.config.ocm.software
consumers:
- identity:
type: ociRegistry
hostname: <YOUR-REGISTRY>/<YOUR-REPO> # e.g. ghcr.io/acme/acme
credentials:
- type: Credentials
properties:
username: <YOUR-USERNAME>
password: <YOUR-PASSWORD>More information on the credentials topic can be found by running the OCM CLI help topic command ocm credential-handling
and in the guide
Credentials in an .ocmconfig File, which contains many examples for different repository types.