Python starter for configuring neomutt with Gmail OAuth.
Project description
mutt-wizard
Configure neomutt with Gmail app passwords (default) or OAuth (optional), and generate mbsync/msmtp configuration files.
This repo focuses on a minimal setup for:
- Gmail app passwords (default, simple)
- Gmail OAuth (optional)
- neomutt account configs
- isync/mbsync sync
- msmtp sendmail
Table of contents
- Why this project
- What this tool creates
- Requirements
- Install
- Gmail app password (default, simplest)
- Gmail OAuth setup (optional)
- Why OAuth needs a plugin
- Non-Gmail account
- Sync mail
- Commands
- Reset (wipe everything created by mw)
- macOS notes
- Linux notes
- Troubleshooting
Why this project
Luke Smith’s original mutt-wizard is effectively unmaintained, and Gmail now requires OAuth or app passwords. This repo keeps the idea alive with a readable Python setup that works today.
What this tool creates
~/.config/mutt-wizard/config root~/.config/mutt-wizard/mbsyncrc~/.config/mutt-wizard/msmtp/config~/.config/mutt-wizard/tokens/Gmail OAuth tokens~/.config/mutt/accounts/*.muttrc~/.config/mutt/muttrc(sourced once)~/.local/share/mail/Maildir storage
Requirements
Common:
- Python 3.10+
- neomutt
- isync (mbsync)
- msmtp
- ca-certificates
- pass + GPG (only for non-Gmail accounts)
Optional:
- notmuch
- lynx
- abook
- urlview
- mpv
Install
Use uv so the mw and mailsync entrypoints are consistent across macOS and Linux.
uv venv --clear && source .venv/bin/activate
uv pip install -e .
To install as global executables:
uv pip install .
or:
uv tool install .
Gmail app password (default, simplest)
This is the default for Gmail because it “just works” on macOS and Linux without requiring the XOAUTH2 plugin.
Requirements:
- 2FA enabled on your Google account
- an app password created in Google Account security
Add the account:
mw add --gmail --email you@gmail.com
pass insert you@gmail.com
Gmail OAuth setup (optional)
- Create OAuth credentials in Google Cloud:
- https://console.cloud.google.com/apis/credentials
- Create OAuth client ID (Desktop app)
- Download the JSON file
- Ensure the Gmail API is enabled for the project.
- If the consent screen is in Testing, add your Gmail address as a test user.
Then run:
mw add --gmail-oauth --email you@gmail.com --client-secrets /path/to/client_secret.json
If your browser cannot open, add --no-browser and follow the console flow.
Why OAuth needs a plugin
mbsync uses Cyrus SASL for OAuth. On macOS/Homebrew, the XOAUTH2 SASL plugin
is not bundled, so you must install it (or use app passwords).
Non-Gmail account
mw add --email you@example.com --imap imap.example.com --smtp smtp.example.com
Passwords are read via pass. Example:
pass insert you@example.com
Sync mail
mailsync
mailsync you@gmail.com
mailsync runs mbsync -c ~/.config/mutt-wizard/mbsyncrc and runs notmuch new
only if ~/.notmuch-config exists.
You can also run mbsync directly:
mbsync -c ~/.config/mutt-wizard/mbsyncrc -a
Commands
mw add --gmail --email you@gmail.com
mw add --gmail-oauth --email you@gmail.com --client-secrets /path/to/client_secret.json
mw add --email you@example.com --imap imap.example.com --smtp smtp.example.com
mw list
mw oauth login --email you@gmail.com
mw oauth token you@gmail.com
mw reset
mailsync
Reset (wipe everything created by mw)
mw reset
This removes:
~/.config/mutt-wizard- account muttrc files under
~/.config/mutt/accounts - mw entries in
~/.config/mutt/muttrc - maildirs under
~/.local/share/mail/<account> ~/.config/isyncrcsymlink (if created)- msmtp log created by mw
macOS notes
Install dependencies (Homebrew)
brew install neomutt isync msmtp pass gnupg notmuch lynx
Gmail XOAUTH2 SASL plugin (macOS only)
On macOS, Homebrew’s cyrus-sasl does not ship the XOAUTH2 plugin, so Gmail
auth will fail unless you install it. This is a macOS/Homebrew limitation, not a
Linux requirement.
If you see:
Error performing SASL authentication step: SASL(-1)
Install the plugin with the helper script (builds in a temp dir):
./scripts/install_xoauth2_macos.sh
After that, plain mailsync works with no flags because the path is written to
~/.config/mutt-wizard/env.
If you prefer not to build a plugin, use Gmail app password mode above.
you can run mailsync with the plugin path:
mailsync --sasl-path /opt/homebrew/lib/sasl2 yrwqid@gmail.com
if its still not working, try setting the SASL_PATH environment variable:
export SASL_PATH=/opt/homebrew/lib/sasl2
Linux notes
Install dependencies (Debian/Ubuntu)
sudo apt install neomutt isync msmtp pass gnupg ca-certificates notmuch lynx
For Gmail XOAUTH2 support, also install:
sudo apt install libsasl2-modules
Install dependencies (Arch)
sudo pacman -S neomutt isync msmtp pass gnupg ca-certificates notmuch lynx
For Gmail XOAUTH2 support, install a SASL XOAUTH2 plugin (AUR example):
paru -S cyrus-sasl-xoauth2
Troubleshooting
403 access_denied on OAuth
- Ensure Gmail API is enabled for your Google Cloud project.
- Ensure OAuth consent screen is configured.
- If in Testing, add your Gmail as a test user.
SASL authentication failure
- macOS: install XOAUTH2 plugin with
./scripts/install_xoauth2_macos.sh - Linux: install SASL XOAUTH2 modules (
libsasl2-modulesor distro equivalent) - Ensure
SASL_PATHpoints to the SASL plugin directory if needed.
notmuch error on mailsync
mailsync only runs notmuch if ~/.notmuch-config exists. Run notmuch setup
if you want it enabled.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mutt_wizard-0.1.2.tar.gz.
File metadata
- Download URL: mutt_wizard-0.1.2.tar.gz
- Upload date:
- Size: 13.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39d3f8837673f01521b569bf1b4514f03723688865a263be9f1299875b0460c1
|
|
| MD5 |
c978dedc2e8ba174d370523fa7351750
|
|
| BLAKE2b-256 |
37530ca4feca1818aea73e00e31709576d434dbb2f583fac52e64ebd97d27cdf
|
File details
Details for the file mutt_wizard-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mutt_wizard-0.1.2-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
408a8e1e9ef6417f8d6a10cf486705337755d7b9948c9b865b25c0b13b6e4949
|
|
| MD5 |
a57e5027b4a997c6bfb608bd8a56c626
|
|
| BLAKE2b-256 |
f501cc95e06391655368c609a28ab5420bbd9c76f852b8fed6a87ab742545c21
|