Permalink
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
138 lines (88 sloc) 6.4 KB
---
title: Installing the cf CLI
owner: CLI
---
<strong><%= modified_date %></strong>
This topic describes how to install the Cloud Foundry Command Line Interface (cf CLI). Follow the instructions below for your operating system. If you previously used the cf CLI v5 Ruby gem, [uninstall](#version5) this gem first.
You can install the cf CLI with a package manager, an installer, or a compressed binary.
<%= vars.cli_rec_min_version %>
## <a id="pkg"></a>Use a Package Manager ##
###<a id='pkg-mac'></a> Mac OS X Installation###
For Mac OS X, perform the following steps to install the cf CLI with [Homebrew](http://brew.sh/):
1. Tap the Cloud Foundry formula [repository](https://github.com/cloudfoundry/homebrew-tap):
<pre class="terminal">$ brew tap cloudfoundry/tap</pre>
1. Install the cf CLI:
<pre class="terminal">$ brew install cf-cli</pre>
###<a id='pkg-linux'></a> Linux Installation###
For Debian and Ubuntu-based Linux distributions, perform the following steps:
1. Add the Cloud Foundry Foundation public key and package repository to your system:
<pre class="terminal">$ wget -q -O - https<span>:</span>//packages.cloudfoundry.org/debian/cli.cloudfoundry.org.key | sudo apt-key add -</pre>
<pre class="terminal">$ echo "deb https<span>:</span>//packages.cloudfoundry.org/debian stable main" | sudo tee /etc/apt/sources.list.d/cloudfoundry-cli.list</pre>
1. Update your local package index:
<pre class="terminal">$ sudo apt-get update</pre>
1. Install the cf CLI:
<pre class="terminal">$ sudo apt-get install cf-cli</pre>
For Enterprise Linux and Fedora systems (RHEL6/CentOS6 and up), perform the following steps:
1. Configure the Cloud Foundry Foundation package repository:
<pre class="terminal">$ sudo wget -O /etc/yum.repos.d/cloudfoundry-cli.repo https<span>:</span>//packages.cloudfoundry.org/fedora/cloudfoundry-cli.repo</pre>
1. Install the cf CLI, which also downloads and adds the public key to your system:
<pre class="terminal">$ sudo yum install cf-cli</pre>
## <a id="installer"></a>Use an Installer ##
Follow the instructions for your operating system below.
### <a id="windows"></a>Windows Installation###
You can run cf CLI in either the Windows Subsystem for Linux (WSL), also known as Bash on Windows, or in the
Windows command line.
To use WSL, follow the [Linux Installation](#pkg-linux) instructions.
To use the cf CLI installer for the Windows command line, perform the following steps:
1. Download [the Windows installer](https://cli.run.pivotal.io/stable?release=windows64&source=github).
1. Unpack the zip file.
1. Right click on the 'cf_installer' executable and select "Run as Adminstrator"
1. When prompted, click **Install**, then **Finish**.
1. To verify your installation, open a command prompt and type `cf`.
If your installation was successful, the cf CLI help listing appears.
### <a id="mac"></a>Mac OS X Installation###
To use the cf CLI installer for Mac OS X, perform the following steps:
1. Download [the OS X installer](https://cli.run.pivotal.io/stable?release=macosx64&source=github).
1. Open the `.pkg` file.
1. In the installer wizard, click **Continue**.
1. Select an install destination and click **Continue**.
1. When prompted, click **Install**.
1. To verify your installation, open a terminal window and type `cf`.
If your installation was successful, the cf CLI help listing appears.
### <a id="linux"></a>Linux Installation###
To use the cf CLI installer for Linux, perform the following steps:
1. Download the Linux installer for your [Debian/Ubuntu](https://cli.run.pivotal.io/stable?release=debian64&source=github)
or [Red Hat](https://cli.run.pivotal.io/stable?release=redhat64&source=github) system.
1. Install using your system's package manager. Note these commands may require `sudo`.
* For Debian/Ubuntu, run the following command:
<pre class="terminal">$ dpkg -i path/to/cf-cli-*.deb && apt-get install -f</pre>
* For Red Hat, run the following command:
<pre class="terminal">rpm -i path/to/cf-cli-*.rpm</pre>
1. To verify your installation, open a terminal window and type `cf`.
If your installation was successful, the cf CLI help listing appears.
## <a id="bin"></a>Use a Compressed Binary##
Download the compressed binary for Mac OS X, Windows, or Linux from the cf CLI GitHub [repository](https://github.com/cloudfoundry/cli#installers-and-compressed-binaries) and install it on your system.
The specific procedures vary by operating system, but the following example illustrates downloading and installing the binary on Mac OS X:
1. Download and extract the Mac OS X binary:
<pre class="terminal">$ curl -L "https<span>:</span>//cli.run.pivotal.io/stable?release=macosx64-binary&source=github" | tar -zx</pre>
1. Move it to `/usr/local/bin`, or another location in your `$PATH`:
<pre class="terminal">$ mv cf /usr/local/bin</pre>
1. Confirm your cf CLI version:
<pre class="terminal">$ cf --version</pre>
## <a id="nextstep"></a>Next Steps ##
See [Getting Started with cf CLI](./getting-started.html) for more information about how to use the cf CLI.
We recommend that you review our [CLI releases page](https://github.com/cloudfoundry/cli/releases) to learn when updates are released, and download a new binary or a new installer when you want to update to the latest version.
## <a id="uninstall"></a>Uninstall the cf CLI ##
### <a id="uninstall-pkg"></a>Package Manager###
If you previously installed the cf CLI with a package manager, follow the instructions specific to your package manager to uninstall the cf CLI.
The specific procedures vary by package manager, but the following example illustrates uninstalling the cf CLI with Homebrew:
<pre class="terminal">$ brew uninstall cf-cli</pre>
### <a id="uninstall-installer"></a>Installer###
If you previously installed the cf CLI with an installer, perform the instructions specific to your operating system to uninstall the cf CLI:
* For Mac OS, delete the binary `/usr/local/bin/cf`, and the directory `/usr/local/share/doc/cf-cli`.
* For Windows, navigate to the **Control Panel**, click **Programs and Features**, select `Cloud Foundry CLI VERSION ` and click **Uninstall**.
### <a id="uninstall-binary"></a>Binary###
If you previously installed a cf CLI binary, remove the binary from where you copied it.
### <a id="version5"></a>cf CLI v5###
To uninstall, run `gem uninstall cf`.
<p class="note"><strong>Note</strong>: To ensure that your Ruby environment manager registers the change, close and reopen your terminal.</p>