About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
This guide provides detailed, step-by-step instructions for installing the OpenShift Command Line Interface (CLI) on Linux, Windows, macOS. Using different methods. It also covers logging in to the OpenShift CLI to manage your cluster.
1. Installing the OpenShift CLI on Linux Using the Web Console
The OpenShift CLI (`oc`) can be installed on Linux systems by downloading the binary through the OpenShift web console.
Steps:
1. Access the OpenShift web console and locate the help icon (?).

2. Click the help icon (?) to open the help menu.

3. Select "Command Line Tools" from the help menu.
4. Locate the `oc` binary for your Linux platform in the Command Line Tools section.
5. Click "Download oc for Linux" to download the appropriate binary file.
6. Save the downloaded file to a preferred location on your system.
7. Unpack the downloaded archive by running the following command in a terminal:
$ tar xvf <file>
Replace `<file>` with the name of the downloaded archive.
8. After moving the 'oc' binary, use the OpenShift CLI with the following command:
$ oc <command>
Replace '<command>' with the desired 'oc' command to interact with your OpenShift cluster.
2. Installing the OpenShift CLI on Windows Using the Web Console
The OpenShift CLI (`oc`) can be installed on Windows systems by downloading the binary through the OpenShift web console.
Steps:
1. Open the OpenShift web console and locate the help icon (?).

2. Click the help icon (?) to access the help menu.

3. Select "Command Line Tools" from the help menu.
4. Locate the `oc` binary for the Windows platform in the Command Line Tools section.
5. Click "Download oc for Windows for x86_64" to download the binary file.
6. Save the downloaded file to a preferred location on your system.
7. Unzip the downloaded archive using a ZIP extraction program (e.g., WinZip, 7-Zip).
8. After moving the `oc` binary, use the OpenShift CLI with the following command:
```
C:\> oc <command>
``` Replace `<command>` with the desired `oc` command to interact with your OpenShift cluster.
3. Installing the OpenShift CLI on macOS Using the Web Console
The OpenShift CLI (`oc`) can be installed on macOS systems by downloading the binary through the OpenShift web console.
Steps:
1. Open the OpenShift web console and locate the help icon (?).

2. Click the help icon (?) to open the help menu.

3. Select "Command Line Tools" from the help menu.
4. Locate the `oc` binary for the macOS platform in the Command Line Tools section.
5. Click "Download oc for Mac for x86_64" for Intel-based Macs, or "Download oc for Mac for ARM 64" for Apple silicon (arm64) Macs.
6. Save the downloaded file to a preferred location on your system.
7. Unpack and unzip the downloaded archive using a suitable tool or command in a terminal.
8. After moving the `oc` binary, use the OpenShift CLI with the following command:
```
$ oc <command>
``` Replace `<command>` with the desired `oc` command to interact with your OpenShift cluster.
4. Logging in to the OpenShift Command Line Interface (CLI)
To manage and interact with your OpenShift Container Platform (OCP) cluster, you can log in using the OpenShift CLI (oc). The following steps outline the process for logging in and verifying access to your cluster from your local system.
Prerequisites:
1. You have an active OCP cluster reservation and valid OCP login credentials.
2. The OpenShift CLI (oc) is installed on your local system. Refer to the official OpenShift documentation for installation instructions.
Steps:
1. Access the Login Command from the OpenShift Web Console Navigate to the reservation page of your OpenShift cluster in a web browser. In the top-right corner of the page, locate the Kube:Admin dropdown menu. Click the dropdown and select Copy Login Command to retrieve the CLI login command.

2. Authenticate to the OpenShift Cluster After selecting Copy Login Command, a prompt will appear directing you to authenticate and access the cluster. Follow the on-screen instructions to log in to the OCP cluster. Upon successful authentication, a Display Token link or button will be displayed. Click this link to reveal the login token and associated command.

3. Copy and Execute the Login Command In the displayed token information, locate the command under the section labeled Login with this Token. Copy this command to your clipboard. Open a command prompt or terminal on your local system, paste the copied command, and press Enter to execute it. This action will authenticate your session and establish a connection to the OCP cluster, allowing you to manage it from your local system.
4. Verify the Current Project To confirm that you have successfully logged in and can interact with the cluster, run the following command in your terminal or command prompt: oc project This command displays the name of the current project in your OpenShift cluster, verifying that your CLI session is active and properly connected.