In a remarkable two-year effort, the maintainers of the popular Fish Shell have officially released a beta of Fish 4.0—this time written almost entirely in Rust instead of C++. What began in early 2023 as a playful pull request jokingly titled “Rewrite it in Rust” has now resulted in a full-fledged transition.
Believe it or not, initially, nobody really expected this idea to escalate into a massive undertaking, especially given Fish had already been ported from pure C to C++ in its earlier days.
Over time, however, practical considerations—like improved tooling, easier maintenance, safer concurrency, and the appeal of learning or using a “cool” language—prompted the maintainers to turn this tongue-in-cheek proposal into a serious endeavor. And here we are, with the first beta of Fish Shell 4.0 now a fact, fully Rust-based.
The beta works very well. Performance is usually slightly better in terms of time taken, memory use has a slightly higher floor but a lower ceiling – it will use 8M instead of 7M at rest, but e.g. globbing a big directory won’t make it go up as much. These things can all be improved, of course, but for a first result it is encouraging.
During development, the team adopted a gradual approach, porting one subsystem at a time from C++ to Rust. They relied on a bridging tool called autocxx, which allowed them to call Rust components from within the legacy C++ codebase (and vice versa).
In essence, Fish maintained partial Rust and partial C++ codebases until the last chunk of C++ finally disappeared in early 2024. This strategy kept fish testable and functional throughout the rewrite, thus allowing regular releases—such as the C++-based Fish 3.7.0—while the overall Rust migration continued.
The thing that many are probably asking now is why Rust? According to the maintainers, one of the most pressing reasons for this switch was the C++ tooling and community ecosystem, which can be challenging to navigate, especially for hobbyist or volunteer-driven projects.
Concurrency also posed a major motivation; Fish’s autosuggestions and syntax highlighting have long been recognized for their advanced thread usage, but implementing further multithreading in C++ proved tricky. Rust’s promise of “fearless concurrency,” backed by the Send and Sync traits, offered a cleaner and safer path forward.
Moreover, Rust boasts superior dependency management and intuitive compiler error messages. Instead of dealing with compiler mismatch woes—where contributors needed to find or install the right C++ version—Rust developers can simply run rustup
and get a consistent environment right away.
However, an unfortunate loss due to Rust switch being Cygwin (a compatibility layer that lets you run Linux tools and applications on Windows) support—but developers are confident Fish’s main user base (primarily Linux, BSD, and macOS users) remains well-covered.
Lastly, here are some interesting facts for those who love statistics and precise numbers. Over roughly 14 months of development, the Fish maintainers produced over 2,600 commits by more than 200 authors, translating over 57,000 lines of C++ into around 75,000 lines of Rust.
Going forward, the devs plan to refine Rust-based features, possibly revamping Fish’s old quirks—like UTF-32 string handling—and continuing to streamline the build process. For more information, refer to the official announcement.