# McFly

> Replaces ctrl-r shell history search with a full-screen search ranked by a small neural network using directory, prior commands, and exit status.

Stars: 7.8k · Language: Rust · License: MIT · Categories: Shell

- Repository: https://github.com/cantino/mcfly
- Page: https://www.trmn.sh/tools/mcfly

## Install

- Homebrew: `brew install mcfly`
- MacPorts: `sudo port install mcfly`
- WinGet: `winget install AndrewCantino.McFly`

## Overview

McFly is a shell history search tool written in Rust. It rebinds `ctrl-r` in Zsh, Bash (version 3+), Fish, and PowerShell (version 7+) to open a full-screen reverse history search. Results are ranked in real time by a small neural network instead of by recency alone.

To support ranking, McFly records each command's exit status, timestamp, and execution directory in a SQLite database. The ranking takes into account the directory where a command was run, the commands typed before it, how often and how recently it was run, whether you selected it in McFly before, and its historical exit status, so old failed commands rank lower. Your normal shell history file is still maintained, so you can stop using McFly at any time. A built-in action removes a history item from both the McFly database and your shell history files.

Other capabilities include `%` as a wildcard in searches, Unicode support, optional fuzzy matching (`MCFLY_FUZZY`), and a vim key scheme (`MCFLY_KEY_SCHEME=vim`). You can also set a light color scheme, the number of results (`MCFLY_RESULTS`, default 30), top or bottom interface placement, and result sorting by rank or last run. `mcfly dump` writes history to stdout as JSON or CSV. It can filter by `--since` and `--before` timestamps and by regex with `-r`. It is aimed at developers and sysadmins who work in the terminal and rely on history recall. The README notes the project is looking for co-maintainers.

### Installation

```bash
# via Homebrew
brew install mcfly
```

```bash
# via MacPorts
sudo port install mcfly
```

```bash
# via WinGet
winget install AndrewCantino.McFly
```

![McFly full-screen history search](https://media.trmn.sh/cached/b48dbbb7dc6a0e01fe575d108254544fb35c7af16547d8477c43418eab492af7.png)

## Alternatives

- [genact](https://www.trmn.sh/tools/genact.md): Terminal program that prints fake activity output (compilers, builds, botnets, downloads) to look busy. Runs natively or in a browser via WebAssembly. (Rust, 12.2k stars)
- [vivid](https://www.trmn.sh/tools/vivid.md): Generates LS_COLORS values from YAML filetype databases and color themes, for ls, tree, fd, bfs, dust and other tools. (Rust, 2.3k stars)
- [atuin](https://www.trmn.sh/tools/atuin.md): Shell history management with SQLite storage, search interface, and encrypted sync across machines (Rust, 32.1k stars)
- [fish](https://www.trmn.sh/tools/fish.md): Interactive command line shell with syntax highlighting, autosuggestions, and tab completions that work without configuration (Rust, 34.4k stars)
- [zoxide](https://www.trmn.sh/tools/zoxide.md): Smart cd replacement that remembers frequently used directories for quick navigation (Rust, 40.3k stars)

---

Canonical: https://www.trmn.sh/tools/mcfly
