Revision of HOWTO Set up the info command in mingw + msys from 2013, July 23 - 22:18

Printer-friendly version

As mentioned in the comments for this page, these instructions are primarily aimed at the user who wants to use the msys "info" command-line tool. It does not address setup or usage of any of the other info-format reader programs that are available. This page is also primarily directed at users who choose to execute mingw and msys tools in a cmd.exe window, and not at users who choose to execute the tools in an msys "sh.exe" window, whether that is a mintty window, an rxvt window or just a native sh.exe window. That said however, the value needed for the INFOPATH variable and the instinfo.sh shell script described below may well be of use to sh.exe users.

The mingw-get-inst method of installing mingw+msys on your Windows PC is a very easy way to get started using mingw and msys. However, although the "info" binary command is delivered with the installation, the command itself does not work at all because there is no info DIR file in the delivered set of files, so any invocation of the "info" command results in the same error message:

    C:\MinGW\home\username>info
    info: dir: No such file or directory

There are only a couple of things you need to do to get the info command working. The first is to set up the INFOPATH variable in your environment. You can set up INFOPATH in the usual Windows way (see HOWTO Set the HOME variable for cmd exe) by permanently assigning a value for your Windows user identity (it is NOT recommended to set it up globally for all users on your machine, but if you are the only one on the machine you could put it there too), or you can set up a simple batch command file to do it for you whenever you are in a cmd.exe window and are about to use info or other mingw or msys tools.

In any case, the value of the INFOPATH environment variable should be set as follows (using cmd.exe syntax):

    set INFOPATH=/mingw/share/info:/usr/share/info

Note the use if the *ix path separator ":" and not the Windows path separator ";". If you look for *.info files using Windows Explorer, then "/mingw/share/info" is really "C:\MinGW\share\info" in Windows terms (at least it is if you take the defaults suggested by the mingw-get-inst install process). Similarly, "/usr/share/info" is "C:\MinGW\msys\1.0\share\info". According to a recent post on the mingw-users mailing list, mingw packages will put their *.info files in /mingw/share/info and msys packages will put their *.info files into /usr/share/info.

The second thing that you need to do to get the "info" command working is to create the DIR file, the "top-level" file for all "*.info" information files. I used a simple shell file to do this, and I called it infoinst.sh. Here is the entire shell file:

    #!/bin/sh
    if [ -f /mingw/share/info/dir ] ; then
        rm /mingw/share/info/dir
    fi
    for F in /mingw/share/info/*.info /usr/share/info/*.info ; do
        echo install-info --info-dir=/mingw/share/info $F ;
        install-info --info-dir=/mingw/share/info $F ;
    done

Note that I surely violate the *ix philosophy of a command keeping silent if everything "just works", but I subscribe to the philosophy that I need to see what is going on if I am to determine where the problem is when something goes wrong, so I included the (truly, superfluous) echo command to tell me what is happening. The "install-info" command can only take ONE *.info file name at a time, so command-line globbing (e.g., /usr/share/info/*.info) does NOT work for "install-info". Each file needs to be added to DIR in its own separate invocation of "install-info", hence the "for" loop. There may well be a way to do it with xargs, but I am not that good a shell script writer yet to know if that is possible or how to code it.

Just copy those lines to a shell file (the file name is your choice of course, you don't have to use my file name), save it and then execute it using the shell. On my system it produces the following output in a cmd.exe window:

    C:\MinGW\home\username>sh -c ./instinfo.sh
    install-info --info-dir=/mingw/share/info /mingw/share/info/cpp.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/cppinternals.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gcc.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gccinstall.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gccint.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gfortran.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gmp.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gnat-style.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gnat_rm.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/gnat_ugn.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/libgomp.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/libquadmath.info
    install-info --info-dir=/mingw/share/info /mingw/share/info/mpfr.info
    install-info --info-dir=/mingw/share/info /usr/share/info/bash.info
    install-info --info-dir=/mingw/share/info /usr/share/info/gawk.info
    install-info --info-dir=/mingw/share/info /usr/share/info/gawkinet.info
    install-info --info-dir=/mingw/share/info /usr/share/info/info-stnd.info
    install-info --info-dir=/mingw/share/info /usr/share/info/info.info

I have installed several packages in addition to the ones delivered in the basic mingw-get-inst installation, so if you are running this shell script right after using mingw-get-inst to set up your system you will see fewer *.info files listed than you see above.

After it executes then just typing "info" should get you to the "dir" top-level directory to find the information you need.

Any time you use mingw-get to install a new package and you know that the package has installed *.info files, you can re-execute the instinfo.sh command to re-create the "dir" file with all of your old and new info file content added.

Site Status

Site maintenance completed May 25th, 2012 at 12:38 UTC