1 [[!img notmuch-logo.png alt="Notmuch logo" class="left"]]
2 # Getting Started with Notmuch
4 *This is a work in progress.*
8 This is your friendly guide and tutorial to getting started with Notmuch. It
9 will help you through the first steps of setting up Notmuch.
11 All Notmuch commands have [[manual pages|manpages]]. Please refer to them for
16 In order to use Notmuch, you will need to have your email messages stored in
17 your local filesystem, one message per file. For example,
18 [Maildir](http://cr.yp.to/proto/maildir.html), Maildir++, and MH formats work
19 like this, while [mbox](https://en.wikipedia.org/wiki/Mbox) does not. Storing
20 the messages one message per file is the only hard dependency for trying out
23 We will get back to delivering messages later, for now we'll just assume you
24 already have messages in this format.
28 On Linux, the easiest way to install Notmuch is through your distribution's
29 package repository. If you're installing Notmuch from a [git
30 checkout](http://git.notmuchmail.org/git/notmuch) or a [source
31 release](http://notmuchmail.org/releases/), please refer to the
32 [INSTALL](http://git.notmuchmail.org/git/notmuch/blob/HEAD:/INSTALL) document.
36 To configure Notmuch, just run
40 This will interactively guide you through the setup process, and save the
41 configuration to `$HOME/.notmuch-config`. If you'd like to change the
42 configuration in the future, you can either edit that file directly, or run
45 This step only modifies the configuration file.
49 Notmuch needs a search database to operate. The next step is to run
53 to index all your messages in the search database. The database will be stored
54 in `.notmuch` directory under your mail store. The database is not a replacement
55 or storage for your messages; it's just an index to find the right message
58 Notmuch does not modify or delete your mails. This is one of the main design
59 principles of Notmuch. (The only exception is renaming files upon tagging
60 according to the Maildir specification if the `maildir.synchronize_flags`
61 configuration option is set.) It should be safe to try Notmuch.
63 Depending on the amount of mail you have the initial indexing process can take a
64 long time, so expect that. Also, the resulting database will require roughly the
65 same amount of storage space as your current collection of email.
67 After this step, you can try out the [[Notmuch command-line
68 interface|manpages]], or [[Notmuch Emacs interface|notmuch-emacs]].
70 ## Converting Existing mbox to Maildir
72 ## Delivering New Messages
74 Notmuch itself does not receive messages. There is no IMAP or POP support. You
75 will need to set up other tools, such as fetchmail, offlineimap, or mbsync, to
78 There are two ways to deliver and index messages:
80 * Use an external tool (such as offlineimap or mbsync) to deliver the messages
81 to your mail store, and run `notmuch new` to discover and index the newly
82 delivered messages (and any other changes in the mail store).
84 * Use an external tool (such as fetchmail) receive the messages, and configure
85 the tool to use `notmuch insert` as a Mail Delivery Agent to deliver the
86 messages to your mail store and index them.
88 ## Automation Via Hooks
90 Notmuch supports running [[user defined hooks|manpages/notmuch-hooks-5]] before
91 or after certain commands. Hooks can be arbitrary executable programs or
92 scripts. For example, if you always run your mail delivery tool first and
93 `notmuch new` after that, you can run the tool from Notmuch `pre-new` hook, and
94 simply run `notmuch new` to do both. If you always do some tagging after
95 indexing of new messages, you may want to set up a `post-new` or `post-insert`
96 hook to do that automatically.
98 ## Backing up and Restoring the Database
102 Did not like it after all? All you need to do is remove the database and the
103 configuration file. The database is stored in the `.notmuch` directory under
104 your mail store. And your mail store is at `notmuch config get database.path`.
106 Note that the database is where the tags are stored. Everything else can be
107 regenerated by indexing again, but the tags will be lost when the database is
108 removed. Use the `notmuch dump` command to create a backup of the tags.