Installing the cf CLI

This topic describes how to install and uninstall the Cloud Foundry Command Line Interface (cf CLI).

Overview

The cf CLI is the official command line client for Cloud Foundry.

Follow the instructions in this topic to install the cf CLI on your operating system. You can install the cf CLI with a package manager, an installer, or a compressed binary.

For more information about how to use the cf CLI, see Getting Started with cf CLI.

To learn when cf CLI updates are released and to download a new binary or installer, see Releases in the GitHub.

Prerequisites

If you previously used the cf CLI Ruby gem, you must uninstall the gem before installing the cf CLI.

To uninstall the gem, do the following:

  1. Run gem uninstall cf.

  2. Verify that your Ruby environment manager uninstalled the gem by closing and reopening your terminal.

Install the cf CLI Using a Package Manager

This section describes how to install the cf CLI using a package manager. You can install the cf CLI using a package manager on Mac OS X and Linux operating systems.

Linux Installation

There are two ways to install the cf CLI using a package manager, depending on your Linux distribution.

To install the cf CLI on Debian and Ubuntu-based Linux distributions, do the following:

  1. Add the Cloud Foundry Foundation public key and package repository to your system:

    wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -
    
    echo "deb https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
    
  2. Update your local package index:

    sudo apt-get update
    
  3. Install the cf CLI:

    sudo apt-get install cf-cli
    

To install the cf CLI on Enterprise Linux and Fedora RHEL6/CentOS6 and later distributions, do the following:

  1. Configure the Cloud Foundry Foundation package repository:

    sudo wget -O /etc/yum.repos.d/cloudfoundry-cli.repo https://packages.cloudfoundry.org/fedora/cloudfoundry-cli.repo
    
  2. Install the cf CLI. The following command also downloads and adds the public key to your system.

    sudo yum install cf-cli
    

Mac OS X Installation

You can install the cf CLI on Mac OS X operating systems using the Homebrew package manager.

To install the cf CLI for Mac OS X using Homebrew, do the following:

  1. Install Homebrew. For instructions, see Install Homebrew on the Homebrew website.

  2. Install the cf CLI:

    brew install cloudfoundry/tap/cf-cli
    

Install the cf CLI Using an Installer

This section describes how to install the cf CLI using an installer. You can install the cf CLI using an installer on Windows, Mac OS X, and Linux operating systems.

Linux Installation

This section describes how to install the cf CLI using an installer on the Debian, Ubuntu, and Red Hat Linux distributions.

To install the cf CLI for Linux using an installer, do the following:

  1. Download the Linux installer.

    • Debian or Ubuntu: Paste the following URL in a browser to download the installer:

      https://cli.run.pivotal.io/stable?release=debian64&source=github
      
    • Red Hat: Paste the following URL in a browser to download the installer:

      https://cli.run.pivotal.io/stable?release=redhat64&source=github
      
  2. Install the cf CLI using your system’s package manager.

    Note: The following commands may require sudo.

    • Debian or Ubuntu: Run the following command:

      dpkg -i path/to/cf-cli-*.deb && apt-get install -f
      
    • Red Hat: Run the following command:

      rpm -i path/to/cf-cli-*.rpm
      

Mac OS X Installation

This section describes how to install the cf CLI on Mac OS X operating systems using an installer.

To install the cf CLI for Mac OS X using an installer, do the following:

  1. Paste the following URL in a browser to download the installer:

    https://cli.run.pivotal.io/stable?release=macosx64&source=github
    
  2. Open the .pkg file.

  3. In the installer wizard, click Continue.

  4. Select an install destination and click Continue.

  5. Click Install.

Windows Installation

This section describes how to install the cf CLI for use on the Windows command line. For instructions on how to install the cf CLI for use on the Windows Subsystem for Linux (WSL), also known as Bash, see Linux Installation above.

To install the cf CLI for Windows using an installer, do the following:

  1. Paste the following URL in a browser to download the installer:

    https://cli.run.pivotal.io/stable?release=windows64&source=github
    
  2. Unzip the file.

  3. Right-click on the cf_installer executable and select Run as Administrator.

  4. When prompted, click Install. Then, click Finish.

Install the cf CLI Using a Compressed Binary

This section describes how to install the cf CLI using a compressed binary. You can install the cf CLI using a compressed binary on Windows, Mac OS X, and Linux operating systems.

For more information about downloading and installing a compressed binary, see the Installers and compressed binaries section of the cf CLI repository on GitHub.

Verify Installation

To verify the installation of the cf CLI, do the following:

  1. Close and reopen the command prompt. Or, open a new tab in the command prompt.

  2. Run the following command:

    cf --help
    

    If your installation was successful, the cf CLI help listing appears.

Uninstall the cf CLI

This section describes how to uninstall the cf CLI. There are different methods for uninstalling the cf CLI depending on the installation method.

Package Manager

This section describes how to uninstall the cf CLI if you installed the cf CLI with a package manager.

To uninstall the cf CLI, follow the instructions specific to your package manager.

Installer

This section describes how to uninstall the cf CLI if you installed the cf CLI with an installer. Follow the instructions in this section that are specific to your operating system.

To uninstall the cf CLI on Mac OS X, do the following:

  1. Delete the binary /usr/local/bin/cf.

  2. Delete the directory /usr/local/share/doc/cf-cli.

To uninstall the cf CLI on Windows, do the following:

  1. Navigate to the Control Panel and click Programs and Features.

  2. Select Cloud Foundry CLI VERSION and click Uninstall.

Binary

This section describes how to uninstall the cf CLI if you installed the cf CLI with a binary.

To uninstall the cf CLI, do the following:

  1. Navigate to the location where you copied the binary.

  2. Delete the binary.