TeX Live on cygwin: A few tricks

Since LaTeX works so well in the Linux/UNIX world (with tools like xFig for example) I installed cygwin on my Win7 machine to accompany the win32 installation of TeX Live.  So I already had a TeX Live directory under

C:\Program Files

and then I thought maybe I should just do it all inside cygwin.  but it was not so easy… so this is about “Getting latex to work on cygwin when it is already installed as a windows application in C:\Program Files (texlive in both cases).”

I am on win32 but 64 bit may be the same, I don’t know.

(1) Installed cygwin using setup-x86.exe, including TeX Live.

(2) A quick test using kpathsea shows that the files are not where TeX is expecting them:

kpsewhich --var-value=TEXMFMAIN

does not gives you the actual distribution texmf  tree.  For example, if you run:

texconfig confall

it thinks it should look in


when really it should look in


(3) But this is not so bad — there is a cygwin version of texmf.cnf, you just need to copy it to where texconfig will look for it:

$ cp /usr/share/texmf/web2c/texmf.cnf /usr/share/texmf/web2c/texmf_noncygwin_backup_cnf.bak

$ cp /usr/share/texmf-dist/web2c/texmf.cnf /usr/share/texmf/web2c/

(4) But then it did not work.  The reason was that cygwin default install was incorporating the PATH from Windows into the cygwin PATH.  This was easy to test:

$ echo $PATH

(5) What was happening was that texconfig was finding the config files in the win32 installation and getting confused.  Since I am happy for my cygwin to be essentially independent of any binaries installed outside it (and if I want to use them I’ll tell it to myself) I just changed the PATH statement in my .bash_profile to overwrite the system-defined path with a simple:


(6) And the last trick was that Windows was defining an environment variable

TEXMFCNF=C:\Program Files\TeXLive\texmf-var\web2c

which was misleading texconfig. Whether this was the problem or the whole path was the problem I’m not sure, so I cleaned up both. I just added


to my .bash_profile as well. This may be overkill, but that way if I add a font or something and rerun mktexlsr in the furture when I have forgotten all this it should still work.

(7) Configure TeX…

$ texhash (or mktexlsr) (should list the files it is updating)

$ texconfig confall

I decided to manually create the directories under $HOME that it was expecting, though I don’t think you need to:

$ mkdir -p .cache/texmf/fonts

$ mkdir -p .config/texmf

$ mkdir -pv .local/share/texmf

Then the big one…

$ texconfig init

(8) Note the end of the messages output from init:

WARNING: you are switching to updmap's per-user mappings.

You have run updmap (as opposed to updmap-sys) for the first time; this has created configuration files which are local to your personal account.

Any changes in system map files will *not* be automatically reflected in your files; furthermore, running updmap-sys will no longer have any effect for you.  As a consequence, you have to rerun updmap yourself after any change in the system directories; for example, if a new font
package is added.

If you want to undo this, remove the files mentioned above.

(Run updmap --help for full documentation of updmap.)

Transcript written on "/home/username/.cache/texmf/web2c/updmap.log".
updmap: Updating ls-R files.

(9) And … it works! If it run X (startx, wm or tw at my cygwin prompt) I can use xdvi, xpdf, xFig and so on.

Or just do this.

Tags: , , , , , , , , ,

About Darren

I'm a scientist by training, based in Australia.

3 responses to “TeX Live on cygwin: A few tricks”

  1. Eliud says :

    I think I understand what you want to do. Although Cygwin provides its own Texlive packages, you want to use the packages that come with the Texlive installer itself, “tlmgr”.

    I wanted to do this also, and this worked for me:

    0. Install Texlive with the internet installer
    It is installed in C:\texlive\2014 (for example)

    1. Use Setup.exe to install Cygwin.

    2. Use Setup.exe to install a minimum Texlive, which includes texlive, texlive-collection-basic, and libkpathsea6

    3. With that minimum installation go to /usr/share/texmf-dist/web2c/texmf.cnf

    This file should normally not be changed, but since I won’t install other Cygwin Texlive collections I will just modify it once and that’s it.

    Open the file with a text editor and change the values of
    TEXMFROOT = /cygdrive/c/texlive/2014

    Also adjust the other variables accordingly
    TEXMFLOCAL = $TEXMFROOT/../texmf-local

    TEXMFHOME = /cygdrive/c/Users/username/texmf (optional)

    All the other variables can stay the same.

    4. Now, the packages of the Texlive installation will be used.

    The reason I prefer to do it this way is because I feel that keeping a minimum installation of Texlive in Cygwin helps avoid problems if a certain program requires tex to be in its path in Cygwin. As far as I can tell, the binaries are mostly the same, it’s just the external packages from Latex the ones that will be searched.

    • Eliud says :

      Actually, I just tried this again and it seems it is quite simple to make this work.

      0. Install Texlive from the internet.

      Normally, when you install Texlive using the “install-tl-windows.bat” batch file, it will use a graphical user interface, and it will install just about everything, but only for the Windows architecture, that is, win32.

      1. In Cygwin, don’t install any Texlive package with “setup.exe”. If something is installed and you don’t want it, simply remove it with “setup.exe”. Make sure to uncheck the box that brings up the dependencies. If you don’t uncheck this, the packages will simply be reinstalled.

      2. In Cygwin, edit ~/.bashrc and add the appropriate paths.

      It should have something like this

      export PATH=/cygdrive/c/texlive/2014/bin/win32:$PATH

      3. Then close the terminal and open it again so the new path is found. And that’s it. The already installed Texlive should be available from a Cygwin terminal.

      If you want to update the Texlive packages, you have to use the Texlive manager, “tlmgr”, and not Cygwin’s “setup.exe”.

      You can verify that there is only one Tex executable by issuing

      which -a tex


      If a Texlive package from Cygwin is still installed, it may show something like



      Another thing is Texlive provide executables for many systems, that is, win32, Mac, Unix, and so on. It also provides executables directly for Cygwin.

      0. Install Texlive from the internet.

      Open a Cygwin terminal. Instead of using the graphical interface use the script “./install-tl”. This script depends on Perl and ncurses, so these should be installed through “setup.exe” before.

      It will show in a text-based interface the options. Choose Cygwin or Cygwin 64, and also win32 if you want.

      The installation of the collections, schemes or individual packages proceeds as usual. Just verify the directories. If run under Cygwin, the installer will suggest “/usr/local/texlive/2014” as the default, but this can be changed to “/cygdrive/c/texlive/2014” which is equivalent to “C:\texlive\2014”

      At the end, in the Texlive folder there will be binaries for the checked systems, that is,


      1. Again in Cygwin, check .bashrc and add the appropriate path.

      export PATH=/cygdrive/c/texlive/2014/bin/x86_64-cygwin:$PATH

      2. Close and open again the terminal.

      By issuing “which -a tex”, a result like this is possible:


      Cygwin finds first the “native” binary, because it was included in the .bashrc. Then it also finds the “win32” binary. The reason is the Texlive installer puts the win32 directory in the global Windows path, and in general, Cygwin has access to this global path.

      From the Cygwin terminal it is possible to run Cygwin executables (linked against Cygwin libraries), but it can also run the win32 binaries (linked against Windows native libraries). So in this case, I’m not sure having the Cygwin binaries has any advantage.

      Sometimes the Tex formats may be out of date, and strange errors may come out.

      texconfig confall
      fmtutil-sys –all

      Generally solve the problem.

      • Darren says :

        Thanks, that makes a lot of sense! There are always different ways to solve problems, with slightly different benefits, but this seems to cover everything!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: