Update the Info Directory Safely with install-info

Install a package with its own Info manual and it can vanish from the menu anyway, unless install-info registers it in the directory file. This guide adds a manual to a dir menu, checks the proposed change before writing it, and removes the entry again once the manual is gone. Allow about ten minutes. The examples use GNU Texinfo 7.1, from Debian package install-info version 7.1-3build2.

install-info changes the menu file, not the manual itself. A typical system-wide directory is /usr/share/info/dir, so a real update usually needs elevated privileges. Read-only checks and updates to a directory you own do not.

1. Check the installed command

Confirm the executable and its version before trusting anything below. This is an ordinary, read-only check:

$ command -v install-info
/usr/bin/install-info
$ install-info --version
install-info (GNU texinfo) 7.1

ginstall-info is an alias for the same installed program on this system. The local manual pages are generated for GNU Texinfo 7.1 and describe the options used below. Different releases can format diagnostics differently, so lean on the exit status and the resulting file rather than exact wording.

2. Identify the two files

The normal positional form is install-info INFO-FILE DIR-FILE. The first file is one Info manual, optionally compressed. The second is the menu file, its entries grouped into sections. Neither argument has a hidden default, and standard input is not used.

Inspect both paths before changing anything. This example uses the installed Coreutils manual and the system menu:

$ ls -l /usr/share/info/coreutils.info.gz /usr/share/info/dir
$ rg -n 'Coreutils' /usr/share/info/dir
24:* Coreutils: (coreutils).       Core GNU (file, text, shell) utilities.

Your own menu line number and text can differ. The point is to establish which manual is being registered and which directory file will be read and rewritten.

Checkpoint: If the manual path is wrong, stop here. Do not substitute a similarly named file until you have checked it is actually the manual you intend to expose.

3. Preview an update without writing

Use --test, also named --dry-run, for the first pass. Adding --debug makes the files being read, and the suppressed write, visible:

$ install-info --test --debug \
    --info-file=/usr/share/info/coreutils.info.gz \
    --dir-file=/usr/share/info/dir
debug: reading dir file /usr/share/info/dir
debug: reading input file /usr/share/info/coreutils.info.gz
debug: writing dir file /usr/share/info/dir
test mode, not updating dir file /usr/share/info/dir

The wording comes straight from the installed command. writing in the debug trace means it built the prospective result; the final line confirms the directory was not actually updated. Check the file timestamp or hash if you want extra reassurance.

--test is a safe default for a script review. It does not validate the manual's links or prove every Info node is usable; it only checks the directory operation without committing it.

4. Apply the update with the smallest necessary privilege

Once the preview looks right, run the same operation without --test. Writing /usr/share/info/dir normally requires root:

$ sudo install-info \
    --info-file=/usr/share/info/coreutils.info.gz \
    --dir-file=/usr/share/info/dir
$ rg -n 'Coreutils' /usr/share/info/dir
24:* Coreutils: (coreutils).       Core GNU (file, text, shell) utilities.

Some package-managed manuals already have an entry. In that case, install-info may replace or reorganise the matching entry instead of adding a second one. Keep the package manager's normal installation workflow as the source of truth for system manuals.

For a user-owned directory, use an explicit path and skip sudo:

$ install-info --info-file=/path/to/manual.info \
    --dir-file=/path/to/info/dir

If the directory file does not exist, the GNU documentation says install-info creates it when possible, initially with no entries. Check ownership and the destination path first: a typo can quietly create a new menu somewhere you did not intend.

5. Control the section and menu text when needed

Normally the section and entry come from metadata in the Info file itself, using @dircategory and @direntry in the source, before the first @node. If no section is available, the installed command falls back to Miscellaneous, unless you supply --defsection=TEXT.

For a manual whose metadata needs an operational override, preview an explicit section:

$ install-info --test \
    --section='Local tools' \
    --info-file=/path/to/manual.info \
    --dir-file=/path/to/info/dir

Use --entry='* Name: (file)Node. Description.' when the menu item itself must be supplied or replaced. The entry is an Info menu line; extra continuation lines must start with whitespace. Treat the text as data and quote it carefully in the shell. If the manual already carries correct directory metadata, prefer fixing that source and regenerating the manual over keeping a permanent command-line override.

6. Remove an entry when the manual is gone

Removing a manual from disk does not remove its menu entry on its own. Preview the removal first with --delete:

$ install-info --test --delete \
    --info-file=/path/to/manual.info \
    --dir-file=/path/to/info/dir
test mode, not updating dir file /path/to/info/dir

Once the preview checks out, repeat the command without --test. --remove is an alias for --delete. By default, matching names account for suffixes such as .info and .gz; add --remove-exactly when only an exact file-name match is safe.

Warning: Deleting the wrong entry is a menu change that can go unnoticed until someone tries to open the manual. Keep a backup of a hand-maintained directory before a removal, or rely on your package manager's recorded file and reinstall operation for recovery. If a change turns out wrong, restore the backup or rerun the package's normal installation step rather than editing a compressed directory by hand.

7. Diagnose the common traps

Done means