<commit_before>---
description: Compose CLI reference
keywords: fig, composition, compose, docker, orchestration, cli, reference
title: Command-line completion
---

Compose comes with [command completion](http://en.wikipedia.org/wiki/Command-line_completion)
for the bash and zsh shell.

## Installing Command Completion

### Bash

Make sure bash completion is installed.

*  On a current Linux OS (in a non-minimal installation), bash completion should be
available.

*  On a Mac, install with `brew install bash-completion`.

Place the completion script in `/etc/bash_completion.d/`
(or `/usr/local/etc/bash_completion.d/` on a Mac):

```shell
sudo curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
```

On a Mac, add the following to your `~/.bash_profile`:

```shell
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
```

You can source your `~/.bash_profile` or launch a new terminal to utilize
completion.

If you're using MacPorts instead of brew you'll need to slightly modify your steps to the
following:

Run `sudo port install bash-completion` to install bash completion.
Add the following lines to `~/.bash_profile`:

```shell
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
    . /opt/local/etc/profile.d/bash_completion.sh
fi
```

You can source your `~/.bash_profile` or launch a new terminal to utilize
completion.

### Zsh

Place the completion script in your `/path/to/zsh/completion`, using e.g. `~/.zsh/completion/`:

```shell
$ mkdir -p ~/.zsh/completion
$ curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
```

Include the directory in your `$fpath`, e.g. by adding in `~/.zshrc`:

```shell
fpath=(~/.zsh/completion $fpath)
```

Make sure `compinit` is loaded or do it by adding in `~/.zshrc`:
<commit_msg>Update completion.md (#5000)<commit_after>---
description: Compose CLI reference
keywords: fig, composition, compose, docker, orchestration, cli, reference
title: Command-line completion
---

Compose comes with [command completion](http://en.wikipedia.org/wiki/Command-line_completion)
for the bash and zsh shell.

## Install command completion

### Bash

Make sure bash completion is installed.

*  On a current Linux OS (in a non-minimal installation), bash completion should be
available.

*  On a Mac, install with `brew install bash-completion`.

Place the completion script in `/etc/bash_completion.d/`
(or `/usr/local/etc/bash_completion.d/` on a Mac):

```shell
sudo curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/bash/docker-compose -o /etc/bash_completion.d/docker-compose
```

On a Mac, add the following to your `~/.bash_profile`:

```shell
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
```

You can source your `~/.bash_profile` or launch a new terminal to utilize
completion.

If you're using MacPorts instead of brew, you'll need to slightly modify your steps to the
following:

Run `sudo port install bash-completion` to install bash completion.
Add the following lines to `~/.bash_profile`:

```shell
if [ -f /opt/local/etc/profile.d/bash_completion.sh ]; then
    . /opt/local/etc/profile.d/bash_completion.sh
fi
```

You can source your `~/.bash_profile` or launch a new terminal to utilize
completion.

### Zsh

Place the completion script in your `/path/to/zsh/completion`, using e.g. `~/.zsh/completion/`:

```shell
$ mkdir -p ~/.zsh/completion
$ curl -L https://raw.githubusercontent.com/docker/compose/{{site.compose_version}}/contrib/completion/zsh/_docker-compose > ~/.zsh/completion/_docker-compose
```

Include the directory in your `$fpath`, e.g. by adding in `~/.zshrc`:

```shell
fpath=(~/.zsh/completion $fpath)
```

Make sure `compinit` is loaded or do it by adding in `~/.zshrc`:

{'fraction_non_alphanumeric': 0.1370305894056205, 'fraction_numerical': 0.000994777418552599, 'mean_word_length': 4.236979166666667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7620047', 'n_tokens_mistral': 1396, 'n_tokens_neox': 1246, 'n_words': 412}