105 lines (67 sloc) 5.58 KB
title: Using cf CLI Plugins
owner: CLI
<strong><%= modified_date %></strong>
The Cloud Foundry Command Line Interface (cf CLI) includes plugin functionality. These plugins enable developers to add custom commands to the cf CLI. You can install and use plugins that Cloud Foundry developers and third-party developers create. You can review the [Cloud Foundry Community CLI Plugin page]( for a current list of community-supported plugins. You can find information about submitting your own plugin to the community in the [Cloud Foundry CLI plugin repository]( on GitHub.
<p class="warning note"><strong>Warning:</strong> Plugins are not vetted in any way, including for security or functionality. Use plugins at your own risk.</p>
The cf CLI identifies a plugin by its binary filename, its developer-defined plugin name, and the commands that the plugin provides. You use the binary filename only to install a plugin. You use the plugin name or a command for any other action.
<p class="note"><strong>Note</strong>: The cf CLI uses case-sensitive commands, but plugin management commands accept plugin and repository names irrespective of their casing.</p>
## <a id="plugin-directory"></a>Changing the Plugin Directory ##
By default, the cf CLI stores plugins on your workstation in `$CF_HOME/.cf/plugins`, which defaults to `$HOME/.cf/plugins`. To change the root directory of this path from `$CF_HOME`, set the `CF_PLUGIN_HOME` environment variable. The cf CLI appends `.cf/plugins` to the `CF_PLUGIN_HOME` path that you specify and stores plugins in that location.
For example, if you set `CF_PLUGIN_HOME` to `/my-folder`, cf CLI stores plugins in `/my-folder/.cf/plugins`.
## <a id="plugin-install"></a>Installing a Plugin ##
1. Download a binary or the source code for a plugin from a trusted provider.
<p class="note"><strong>Note</strong>: The cf CLI requires a binary file compiled from source code written in Go. If you
download source code, you must compile the code to create a binary.</p>
1. Run `cf install-plugin BINARY-FILENAME` to install a plugin. Replace `BINARY-FILENAME` with the path to and name of your binary file.
<p class="note"><strong>Note</strong>:
You cannot install a plugin that has the same name or that uses the same command as an existing plugin. You will be prompted to uninstall the existing plugin.
<p class="note"><strong>Note</strong>:
The cf CLI prohibits you from implementing any plugin that uses a native cf CLI command name or alias. For example, if you attempt to install a third-party plugin that includes the command <code>cf push</code>, the cf CLI halts the installation.</p>
## <a id="plugin-run-cmd"></a>Running a Plugin Command ##
Use the contents of the `cf help` **CLI plugin management** and **Commands offered by installed plugins** sections to manage plugins and run plugin commands.
1. Run `cf plugins` to list all installed plugins and all commands that the plugins provide.
1. Run `cf PLUGIN-COMMAND` to execute a plugin command.
## <a id="plugins-outdated"></a>Checking for Plugin Updates ##
Run `cf plugins --outdated` to check all registered plugin repositories for newer versions of currently installed plugins.
<pre class="terminal">
$ cf plugins --outdated
Searching CF-Community, company-repo for newer versions of installed plugins...
plugin version latest version
coffeemaker 1.1.2 1.2.0
Use 'cf install-plugin' to update a plugin to the latest version.
For more information about the `cf plugins` command, see [cf plugins](
## <a id="plugin-uninstall"></a>Uninstalling a Plugin ##
Use the `PLUGIN-NAME` to remove a plugin, not the `BINARY-FILENAME`.
1. Run `cf plugins` to view the names of all installed plugins.
1. Run `cf uninstall-plugin PLUGIN-NAME` to remove a plugin.
## <a id="adding-plugin-repo"></a>Adding a Plugin Repository ##
Run `cf add-plugin-repo REPOSITORY-NAME-URL` to add a plugin repository.
<pre class="terminal">
$ cf add-plugin-repo CF-Community https:/<span>/</span>
https:/<span>/</span> added as CF-Community
## <a id="listing-plugin-repo"></a>Listing Available Plugin Repositories ##
Run [cf list-plugin-repos]( to view your available plugin repositories.
<pre class="terminal">
$ cf list-plugin-repos
Repo Name Url
CF-Community https:/<span>/</span>
## <a id="listing-plugin-repo"></a>Listing All Plugins by Repository ##
Run [cf repo-plugins]( to show all plugins from all available repositories.
## <a id="troubleshoot"></a>Troubleshooting ##
The cf CLI provides the following error messages to help you troubleshoot installation and usage issues. Third-party plugins can provide their own error messages.
### Permission Denied###
If you receive a `permission denied` error message, you lack required permissions to the plugin. You must have `read` and `execute` permissions to the plugin binary file.
### Plugin Command Collision###
Plugin names and commands must be unique. The CLI displays an error message if you attempt to install a plugin with a non-unique name or command.
If the plugin has the same name or command as a currently installed plugin, you must first uninstall the existing plugin to install the new plugin.
If the plugin has a command with the same name as a native cf CLI command or alias, you cannot install the plugin.