---
name: "mu-init"
section: "1"
platform: "linux"
package: "maildir-utils"
version: "1.12.9-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mu-init"
---

# mu-init(1)

initialize the mu message database

## NAME

mu-init - initialize the **mu** message database

## SYNOPSIS

**mu** \[*COMMON-OPTIONS*\] **init** \[*OPTIONS*\]

## DESCRIPTION

**mu init** is the subcommand for setting up the **mu** message database. After **mu init** has completed, you can run **mu index**

## INIT OPTIONS

### -m, --maildir *maildir*

Use *maildir* as the root-maildir.

By default, **mu** uses the **MAILDIR** environment; if it is not set, it uses *~/Maildir* if it is an existing directory. If neither of those can be used, the **--maildir** option is required; it must be an absolute path (but `~/` expansion is performed).

### --my-address *email-address-or-regex*

Specifies that some e-mail address is a personal address. The option can be used multiple times, to specify all your addresses.

Any message in which at least one of the contact fields contains such an address is considered a \`personal' message; this can then be used for filtering in [**mu-find**(1)](/mu-find/1.md), [**mu-cfind**(1)](/mu-cfind/1.md) and **mu4e**, e.g. to filter-out mailing list messages.

*email-address-or-regex* can be either a plain e-mail address (such as **foo@example.com**), or a basic PCRE regular-expression (see [**pcre**(3)](/pcre/3.md) for details), wrapped in **/** (such as */foo-.\*@example\\.com/*). Depending on your shell, the argument may need to be quoted.

A note of warning for **mu4e** users: any regular-expressions used with *--with-address* are also used by **mu4e**. Unfortunately, PCRE regular expressions are **not** generally compatible with Emacs regular expressions. For instance, **(foo\|bar)** in PCRE syntax has  as its Emacs equivalent.

The good news is that **mu4e** can automatically translate the regular-expressions, if you allow it to, by installing the **pcre2el** Elisp package. See the **mu4e** documentation for further details.

### --ignored-address *email-address-or-regex*

Specifies that some e-mail address is to be ignored from the contacts-cache (the option can be used multiple times). Such addresses then cannot be found with [**mu-cfind**(1)](/mu-cfind/1.md) or in the Mu4e contacts cache.

*my-email-address* can be either a plain e-mail address or a regexp, just like for the **--my-address** option.

### --max-message-size *size*

Specifies the maximum size for an e-mail message. Usually, the default of 100000000 bytes should be fine.

### --batch-size *size*

The number of changes after which they are committed to the database; decreasing the value reduces the memory requirements, at the cost of make indexing substantially slower. Usually, the default of 250000 should be fine.

Batch-size 0 is interpreted as \`use the default'.

### --support-ngrams

Whether to enable support for using ngrams in indexing and query parsing; this can be useful for languages without explicit word breaks, such as Chinese/Japanese/Korean. See **NGRAM SUPPORT** below for details.

### --reinit

Reinitialize the database from an earlier version; that is, create a new empty database with the existing settings. This cannot be combined with the other **init** options.

### --muhome

Use a non-default directory to store and read the database, write the logs, etc. By default, **mu** uses the XDG Base Directory Specification (e.g. on GNU/Linux this defaults to *~/.cache/mu* and *~/.config/mu*). Earlier versions of **mu** defaulted to *~/.mu*, which now requires **--muhome=~/.mu**.

The environment variable **MUHOME** can be used as an alternative to **--muhome**. The latter has precedence.

## NGRAM SUPPORT

**mu**'s underlying Xapian database supports \`ngrams', which improve searching for languages/scripts that do not have explicit word breaks, such as Chinese, Japanese and Korean. It is fairly intrusive, and influences both indexing and query-parsing; it is not enabled by default, and is recommended only if you need to search for messages written in such languages.

When enabled, **mu** automatically uses ngrams automatically. Xapian environment variables such as **XAPIAN\_CJK\_NGRAM** are ignored.

## EXIT CODE

This command returns 0 upon successful completion, or a non-zero exit code otherwise.

- 0\.

  success

- 2\.

  no matches found. Try a different query

- 11\.

  database schema mismatch. You need to re-initialize **mu**, see [**mu-init**(1)](/mu-init/1.md)

- 19\.

  failed to acquire lock. Some other program has exclusive access to the **mu** database

- 99\.

  caught an exception

## EXAMPLE

```
$ mu init --maildir=~/Maildir --my-address=alice@example.com --my-address=bob@example.com --ignored-address='/.*reply.*/'
```

## REPORTING BUGS

Please report bugs at *https://github.com/djcb/mu/issues*.

## AUTHOR

Dirk-Jan C. Binnema \<djcb@djcbsoftware.nl\>

## COPYRIGHT

This manpage is part of **mu** 1.12.9.

Copyright © 2008-2025 Dirk-Jan C. Binnema. License GPLv3+: GNU GPL version 3 or later *https://gnu.org/licenses/gpl.html*. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

## SEE ALSO

[**mu-index**(1)](/mu-index/1.md), [**mu-find**(1)](/mu-find/1.md), [**mu-cfind**(1)](/mu-cfind/1.md), [**pcre**(3)](/pcre/3.md)
