Download and install the Red Hat OpenShift CLI

Learn how to install the oc command-line interface (CLI) in order to work with your Red Hat OpenShift cluster from a command line.

Access the Developer Sandbox

This lesson walks you through downloading and installing Red Hat OpenShift oc CLI.

Prerequisites:

  • A terminal session on your computer.

In this lesson, you will:

  • Download and install the oc CLI.

The first step is to open the OpenShift dashboard and locate the help (question mark) icon in the upper right corner (Figure 1).

Question mark icon in the upper right corner of the OpenShift dashboard.
Figure 1: Notice the question mark icon; this is where you begin.

Click on the question mark to display the dropdown menu; then click the Command Line Tools option (Figure 2).

Dropdown menu with Command Line Tools option.
Figure 2: Select Command Line Tools.

The Command Line Tools page will appear, from which you can download the proper executable for your operating system. See Figure 3.

List of download options for the OpenShift CLI.
Figure 3: Select the proper download for your operating system.

Finally, download the appropriate compressed file, extract the oc executable, and put it in a directory that is in your system’s path. For Mac and Linux, this is typically /usr/local/bin. For Windows, it’s %ProgramFiles%.

Wrapping up

By following the steps outlined in this lesson, you will have finished with the oc command available at the command line on your computer. This command is used to log into an OpenShift cluster (oc login) and to perform useful command line operations.

If you’re interested in learning more, consult these resources:

Previous resource
Overview: Download and install the Red Hat OpenShift CLI