rFortune is a modern, cross-platform reimplementation of the classic Unix fortune program, written in Rust.
It displays a random quote or witty phrase from a plain text file, making it perfect for terminal startup messages, scripting, or just a bit of inspiration.
β¨ New in v0.5.3
π§ Smarter first-time initialization
- Added an interactive prompt when
rfortuneis launched for the first time and no configuration directory exists.- In interactive terminals, users are asked:
Initialize rFortune now? [Y/n]. - In non-interactive contexts (scripts, CI, etc.), initialization happens automatically.
- In interactive terminals, users are asked:
- Prevents unintended directory creation and improves transparency during first setup.
- Initialization progress and results are displayed using
ConsoleLogmessages for consistency.
βοΈ Improved startup behavior
- The application now clearly reports which configuration directory is being used (
dirs::data_dir()path). - Overall initialization flow refined for clarity and better UX.
π Features
- β Cross-platform: works on Linux, Windows, macOS Intel and Apple Silicon
- β‘ Fast and lightweight (native Rust binary)
- π Simple input format: one or more lines per fortune, separated by
% - πΉ UTF-8 support for multilingual content
- π§© Easily extensible
- π§ Built-in cache system to avoid showing the same fortune twice in a row
- β¨ New CLI with subcommands for config, file initialization and cache management
π¦ Installation
π§ AUR (Arch Linux)
# or
πΊ Homebrew (macOS/Linux)
π¦ Crates.io (Rust)
π₯ Download
Precompiled binaries are available in the Releases section.
| Platform | Architecture | File |
|---|---|---|
| Windows | x86_64 | rfortune-<version>-x86_64-pc-windows-msvc.zip |
| Linux | x86_64 | rfortune-<version>-unknown-linux-gnu.tar.gz |
| macOS Intel Architecture | x86_64 | rfortune-<version>-x86_64-apple-darwin.tar.gz |
| macOS Apple Silicon | aarch64 | rfortune-<version>-aarch64-apple-darwin.tar.gz |
π GPG Signature
All release archives are cryptographically signed with GPG.
.sigfiles contain the ASCII-armored detached signature for the corresponding archive.- You can verify the archive with:
π Public Key
The releases are signed with the following GPG key:
- Key ID: 423FABCE0A1921FB
- Fingerprint: 8118 9716 9512 2A32 1F3D C04C 423F ABCE 0A19 21FB
- Download: https://github.com/umpire274.gpg
To import the key from a keyserver:
Or from OpenPGP server:
Then verify the fingerprint:
π Usage
Running rfortune without subcommands prints a random fortune from the default file (rfortune.dat).
βοΈ First-time setup
When rfortune is launched for the first time and no configuration directory exists,
the application will ask whether to initialize its environment (creating the default
configuration and fortune files).
In non-interactive contexts, initialization happens automatically.
π§© Options & Subcommands
| Command / Option | Description |
|---|---|
-f, --file <PATH> |
Use a custom fortune file instead of the default |
config init |
Create the configuration file with default options |
config edit [--editor <E>] |
Open the configuration file in the systemβs default or a specified editor |
file init |
Create a sample default fortune file (rfortune.dat) |
cache clear |
Remove all cached last-used fortunes |
-V, --version |
Show version information |
-h, --help |
Show help message |
π‘ Examples
# Print a random fortune from the default file (rfortune.dat)
# Print a random fortune from a specific file
# Create the default configuration file in the user data directory
# Open the configuration file in the systemβs default text editor
# Open the configuration file with a specific editor (e.g. vi, nano, code)
# Create a sample default fortune file (rfortune.dat)
# Clear all cached last-used fortunes
π File Format
Each fortune must be on one or more lines separated by %, like so:
%
The best way to get a good idea is to get a lot of ideas.
%
Do or do not. There is no try.
%
To iterate is human, to recurse divine.
%
You may optionally add a title at the top of the file by starting the first line with #. The title will be printed before the random quote:
# Murphy's Laws
%
Anything that can go wrong will go wrong.
%
If there's a possibility of several things going wrong, the one that will cause the most damage will be the one to go wrong.
%
π License
This project is licensed under the MIT License.
Β© 2025 Alessandro Maestri
π‘ Contributing
Pull requests are welcome! If youβd like to add support for more languages, improve performance, or fix bugs, feel free to fork the repo and contribute.
π Acknowledgments
Inspired by the classic BSD fortune program. Built with β€οΈ in Rust.