The Cloud Foundry Command Line Interface (cf CLI) is the official command line client for Cloud Foundry. Use the cf CLI to interact with Cloud Foundry applications and services.
The following procedures describe how 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 Cloud Foundry CLI repository on GitHub.
There are currently two major versions of the cf CLI: v7 and v8. See the README to decide which version to use.
If you have previously used the cf CLI Ruby gem, you must uninstall it before installing the cf CLI.
To uninstall the gem:
Run:
gem uninstall cf
Verify that your Ruby environment manager uninstalled the gem by closing and reopening your terminal.
These sections describe how to install the cf CLI using a package manager. You can install the cf CLI using a package manager on macOS X and Linux operating systems.
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:
Add the Cloud Foundry Foundation public key and package repository to your system by running:
wget -q -O - https://packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo gpg --dearmor -o /usr/share/keyrings/cli.cloudfoundry.org.gpg
echo "deb [signed-by=/usr/share/keyrings/cli.cloudfoundry.org.gpg] https://packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list
Update your local package index by running:
sudo apt-get update
To install cf CLI v7, run:
sudo apt-get install cf7-cli
To install cf CLI v8, run:
sudo apt-get install cf8-cli
To install the cf CLI on Enterprise Linux and Fedora RHEL6/CentOS6 and later distributions:
Configure the Cloud Foundry Foundation package repository by running:
sudo wget -O /etc/yum.repos.d/cloudfoundry-cli.repo https://packages.cloudfoundry.org/fedora/cloudfoundry-cli.repo
To install cf CLI v7, run:
sudo yum install cf7-cli
To install cf CLI v8, run:
sudo yum install cf8-cli
This also downloads and adds the public key to your system.
You can install the cf CLI on macOS X operating systems using the Homebrew package manager.
To install the cf CLI for macOS X using Homebrew:
Install Homebrew. For instructions, see Install Homebrew on the Homebrew website.
To install cf CLI v7, run:
brew install cloudfoundry/tap/cf-cli@7
To install cf CLI v8, run:
brew install cloudfoundry/tap/cf-cli@8
This section describes how to install the cf CLI using an installer. You can install the cf CLI using an installer on Microsoft Windows, Mac OS X, and Linux operating systems.
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:
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
Install the cf CLI using your system’s package manager.
NoteThe following commands might 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
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:
Paste the following URL in a browser to download the installer:
https://cli.run.pivotal.io/stable?release=macosx64&source=github
Open the .pkg
file.
In the installer wizard, click Continue.
Select an install destination and click Continue.
Click Install.
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.
To install the cf CLI for Windows using an installer, do the following:
Paste the following URL in a browser to download the installer:
https://cli.run.pivotal.io/stable?release=windows64&source=github
Unzip the file.
Right-click the cf_installer
executable and select Run as Administrator.
When prompted, click Install. Then, click Finish.
You can install the cf CLI using a compressed binary on Windows, macOS X, and Linux operating systems. This method can be a more secure option compared to installing from a repository, especially in environments where security is a primary concern.
Note As of cf CLI 8.4.0 and cf CLI 7.5.0, the Apple ARM architecture is now supported for installation of cf CLI. This is possible on newer MACs that use M1 and M2 processors. For systems running the M1 processor, cf CLI can now be installed without use of an emulator.
For more information about downloading and installing a compressed binary for cf CLI v7 or cf CLI v8, see Installers and compressed binaries.
To verify the installation of the cf CLI:
Close and reopen the command prompt, or open a new tab in the command prompt terminal.
Run:
cf --help
If your installation was successful, the cf CLI help listing appears.
These sections describe how to uninstall the cf CLI. The method for uninstalling the cf CLI differs depending on the installation method.
If you installed the cf CLI with a package manager, follow the instructions specific to your package manager.
If you installed the cf CLI with an installer, follow the procedure in this section that is specific to your operating system.
To uninstall the cf CLI on macOS X:
Delete the binary /usr/local/bin/cf
.
Delete the directory /usr/local/share/doc/cf-cli
.
To uninstall the cf CLI on Windows:
Go to the Control Panel and click Programs and Features.
Select Cloud Foundry CLI VERSION.
Click Uninstall.
To uninstall the cf CLI after installing it with a binary:
Go to the location where you copied the binary.
Delete the binary.