I have some problems to understand how to manage memory for LaTeX. I use the MacTeX 2011 distribution with no modifications (cad only with TeXLive 2011).

I have searched a lot on internet and on this very good forum (which have similar topics). Anyway all the things I have found and tested do not have worked.

I suppose the file I should modify is the one located on this path:


Originally this file contains:

% (Public domain.)
% This texmf.cnf file should contain only your personal changes from the
% original texmf.cnf (for example, as chosen in the installer).
% That is, if you need to make changes to texmf.cnf, put your custom
% settings in this file, which is .../texlive/YYYY/texmf.cnf, rather than
% the distributed file (which is .../texlive/YYYY/texmf/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
TEXMFHOME = ~/Library/texmf
TEXMFVAR = ~/Library/texlive/2011/texmf-var
TEXMFCONFIG = ~/Library/texlive/2011/texmf-config

Then at the end of this file I should write my modifications (ex: buf_size = 250000).

Anyway this don't seems to work (as error log say me that TeX capacity exceeded, sorry [buffer size=200000]). If the modification were working I would get 250000 instead of 200000.

I have also tested to place a texmf.cnf into ~/Library/texmf or ~/Library/texlive/2011 or ~/texmf/mytexcnf/texmf.cnf (as suggered in Manual for Package pgfplots) and other similar paths Finally I tried to type texhash or fmtutil --all on the terminal but again without success.

I think I'm totally lost and I would greatly appreciate the assistance of experts.

Thanks in advance

  • Are you sure you need to increase the capacity? What is giving you the error?
    – Alan Munn
    Aug 3, 2011 at 1:06
  • It is a graph TikZ extracted from matlab (with matlab2tikz). Perhaps the graph has a problem but I want to test increase some memories options. Even if this graph is broken, knowing how to change memory settings will be necessary for me as I have many graphs to convert. The problem is not the number of graphs as I have already use the options to externally compile the TikZ graphics (\usepackage{tikz,pgfplots} \usepgfplotslibrary{external} \tikzexternalize[prefix=myfigures/]) but that I know that I will have some heavy TikZ graphics to compile. Thanks
    – youyou
    Aug 3, 2011 at 5:42
  • Your file compiles with no error on a standard MacTeX installation (OS 10.6.8; 4GB memory).
    – Alan Munn
    Aug 3, 2011 at 17:07
  • Really ? It is so strange ... I have the latest MacTeX 2011 with 0S 10.6.8 and 8GB. Which editor do you use ? Do you use pdflatex or latex->dvi->pdf ?
    – youyou
    Aug 3, 2011 at 17:15
  • Also, the log file you included in the archive isn't actually the log, it's the output of the console (which isn't quite the same.) Can you upload the actual log file itself?
    – Alan Munn
    Aug 3, 2011 at 17:18

1 Answer 1


To change the memory allocation you should edit /usr/local/texlive/2011/texmf.cnf. On a Mac, these are files owned by the system, and you can't edit them without authenticating as an administrative user.

There are two ways to do this. If you are comfortable with a command line editor such as vi, emacs, pico or nano (all standardly installed in the MacOS) you can use one of these editors to edit the file. To do so you invoke the editor using sudo from an admin account. (Example below, using emacs).

sudo emacs /usr/local/texlive/2011/texmf.cnf

You will be prompted for your password.

If you are not familiar with any of these editors, and would prefer to do this from the regular GUI interface, you can use a good text editor such as the free TextWrangler which will allow you to save system files after authenticating. To do this from the finder, you can do the following:

  • In the Go menu, choose Go to Folder
  • Enter /usr/local/texlive/2011/
  • Control-click on texmf.cnf and choose Open with, then select TextWrangler

Now you can edit the file, and when you save it, TextWrangler will authenticate you.

To increase the main memory to e.g. 7000000 add the line:

main_memory = 7000000 

After you modify /usr/local/texlive/2011/texmf.cnf you need to run

sudo fmtutil-sys --all

This should rebuild the formats with the new values.

It is important that you run sudo fmtutil-sys and NOT fmtutil.

If you have previously run fmtutil by mistake, you should remove the following folder from your local Library (i.e. ~/Library/)


You can do this by navigating to the ~/Library/texlive/2011/ folder and dragging the texmf-var folder to the trash. Alternatively, from the command line you can type:

rm -rf ~/Library/texlive/2011/texmf-var

Of course, if you have existing things in this directory you should not delete all of it, just the web2c directory inside it:

rm -rf ~/Library/texlive/2011/texmf-var/web2c
  • I have tested your command but it didn't have worked. I just have uploaded a file by editing my question. If you have some time can you try compiling it before and after modifying your memory settings (for example: main_memory = 7000000 or buf_size = 250000). Even if it don't work, you will be able to see if a change appears between your two logs. Thanks for your help
    – youyou
    Aug 3, 2011 at 17:06
  • Yes, if I edit /usr/local/texlive/2011/texmf.cnf and then run this command (note the -sys part), the memory is correctly changed. If you ran fmtutil (without the -sys) this may be causing the problem.
    – Alan Munn
    Aug 3, 2011 at 17:32
  • I Have run your command again without success but previously (before to post my question) I ran fmtutil --all. Do you think I should uninstall MacTeX and then reinstall it ? \\ Also to edit the file /usr/local/texlive/2011/texmf.cnf I have set access read/write for me for the file and its folder 2011. Maybe it not the correct way to do that. How do you edit this file ?
    – youyou
    Aug 3, 2011 at 18:02
  • I don't think you need to reinstall anything, but you do need to fix the potential problem you created by running fmtutil and not fmtutil-sys. To do this, you should delete the folder ~/Library/texlive/2011/texmf-var. (This is the one in your home library). To edit the file in /usr/local/texlive/2011/texmf.cnf you need to open the file with an editor like TextWrangler that allows you to edit protected files after asking for your password, or use an editor from the command line and invoke the editor with sudo ... But I really don't think that memory is the source of your problems.
    – Alan Munn
    Aug 3, 2011 at 19:45
  • 1
    @anselm I rolled back your edit since the directory location has not been changed with current versions of MacTeX. Perhaps you are not using a Mac? Or you installed using the TeX Live installer instead of using the MacTeX installer?
    – Alan Munn
    Aug 22, 2016 at 23:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.