---
title: Announcing pick
teaser: Fuzzy select anything.
tags: news,open source,unix,c
author:
- Calle Erlandsson
- Mike Burns
published_on: 2015-03-10
---

[pick] is a fuzzy search tool for the command-line. It is used to select an
entry from a list.

pick reads a list of choices on `stdin` and outputs the selected choice on
`stdout`. Therefore it is easily used both in shell pipelines and subshells.

pick serves the same purpose as
[selecta](https://github.com/garybernhardt/selecta/) but is faster and utilizes
the alternate screen terminal feature to not leave choices on screen after the
program finishes execution.

Here are some things we use this for:

[pick]: https://github.com/thoughtbot/pick

### Switch between git branches

This is especially helpful for those long-running projects with far too many
local branches.

```sh
git checkout $(git branch | cut -c 3- | pick)
```

![Demo](https://images.thoughtbot.com/pick-git-branch.gif)

### Change to an arbitrary subdirectory

```sh
cd $(find . -type d | pick)
```

![Demo](https://images.thoughtbot.com/pick-cd.gif)

### Find and kill a process

```sh
kill $(ps -e | awk '{if(NR!=1) { print $4, $1 }}' | pick -do | tail -n +2)
```

![Demo](https://images.thoughtbot.com/pick-kill.gif)

### Find and edit a file containing a specific word

```sh
vim $(ag -l WORD | pick)
```

![Demo](https://images.thoughtbot.com/pick-ag-vim.gif)

### Change Ruby version

```sh
chruby $(chruby | sed -n 's/.*-//p' | pick)
```

![Demo](https://images.thoughtbot.com/pick-chruby.gif)

### Run a Rake task

```sh
rake $(rake -T | cut -f2 -d' ' | pick)
```

![Demo](https://images.thoughtbot.com/pick-rake.gif)

### Run a command from the history

```sh
$(history | cut -c8- | sort -u | pick)
```

![Demo](https://images.thoughtbot.com/pick-history.gif)

### Find a file to edit from within Vim

Pick can also easily be used from within Vim both using `system()` and `!`.

To make pick even easier to use from within Vim we have written the [pick.vim]
Vim plugin.

To fuzzy-find a file to edit in Vim, install pick.vim and add this mapping to
your `.vimrc`:

```viml
nnoremap <Leader>p :call PickFile()<CR>
```

Please see [the pick.vim README] for more examples of how to use it.  For
examples of how to call pick from within Vim, see [the pick.vim source code].

***Please note:*** pick requires a fully functional terminal to run and
therefore cannot be run from within gvim or MacVim.

![Demo](https://images.thoughtbot.com/pick-vim.gif)

[pick.vim]: https://github.com/thoughtbot/pick.vim/
[the pick.vim README]: https://github.com/thoughtbot/pick.vim/blob/master/README.md
[the pick.vim source code]: https://github.com/thoughtbot/pick.vim/blob/master/plugin/pick.vim

## Installation

On OS X, you can install pick [via Homebrew]:

```sh
brew tap thoughtbot/formulae
brew install pick
```

If you're running Arch Linux you can install it [using the AUR package]:

```sh
wget https://aur.archlinux.org/packages/pi/pick/pick.tar.gz
tar -xzf pick.tar.gz
cd pick
makepkg -s
pacman -U pick-VERSION-x86_64.pkg.tar.xz
```

You can also [build pick from source]:

```sh
wget https://github.com/thoughtbot/pick/releases/download/vVERSION/pick-VERSION.tar.gz
wget https://github.com/thoughtbot/pick/releases/download/vVERSION/pick-VERSION.tar.gz.asc
gpg --verify pick-VERSION.tar.gz.asc
tar -xzf pick-VERSION.tar.gz
cd pick-VERSION
./configure
make
make install
```

[via Homebrew]: https://github.com/thoughtbot/pick#mac-os-x-via-homebrew
[using the AUR package]: https://github.com/thoughtbot/pick#arch-linux
[build pick from source]: https://github.com/thoughtbot/pick#from-source

Don't forget to check out the man page:

```sh
man pick
```

## Contributing

Please report bugs via [GitHub issues].

Pull requests are very welcome. Please, see the [contributing instructions] for
more info on how to get started.

[GitHub issues]: https://github.com/thoughtbot/pick/issues/
[contributing instructions]: https://github.com/thoughtbot/pick/blob/master/CONTRIBUTING.md
