5

I'm currently running Os X 10.11.6 (El Capitan) and, from what I understand, one is supposed to create the texmf folder under the user's Library; however, I was wondering if it is possible to change the location of this folder?

I would like to be able to set the folder on my Dropbox account so that the files stored therein can be accessed from different computers as I do roughly half of my typesetting from a desktop and the other half from a laptop. Is this possible? Although I have a lot of experience using LaTex, I have little-to-no 'under-the-hood' knowledge / understanding (long, slow work-in-progress); thank you for understanding.

4

Another way would be to create a symbolic link ~/Library/texmf pointing wherever you want the texmf tree to be (~/Dropbox/texmf maybe).

  • 2
    This solution might have the advantage that it will survive the update to texlive2017. – user36296 Dec 21 '16 at 21:15
5

You can try editing

/usr/local/texlive/2016/texmf.cnf

which, by default, is

% (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-dist/web2c/texmf.cnf).
% And include *only* your changed values, not a copy of the whole thing!
%
TEXMFHOME = ~/Library/texmf
TEXMFVAR = ~/Library/texlive/2016/texmf-var
TEXMFCONFIG = ~/Library/texlive/2016/texmf-config

Changing the path after TEXMFHOME = you can set the “personal tree” to whatever you like.

You may need superuser privileges to do the edit. You can do it with any text editor, I recommend using nano from the terminal, which is easy to work with:

nano /usr/local/texlive/2016/texmf.cnf

or, if the file requires privileges,

sudo nano /usr/local/texlive/2016/texmf.cnf

The change in settings is immediate.

  • be curious to know your thoughts on the alternative sym-link solution proposed: yours has received more votes & I honestly don't feel qualified to distinguish between the two. e.g. would this have to be repeated over future updates? – Rax Adaam Dec 22 '16 at 18:59
  • 1
    @RaxAdaam Yes, the file is created afresh for each installation. – egreg Dec 22 '16 at 20:39
2

You would think that there would be a way to set the environment variable TEXMFHOME, or perhaps TEXINPUTS, BIBINPUTS and BSTINPUTS, to appropriate values; but Apple has decided they don't like environment variables, so it's a lot harder than it should be. In El Capitan, there seems to be no way to set an environment variable that will be visible to all applications started from the GUI (Launchpad, or by clicking on icons in the Finder). You can still set variables one application at a time, if you are willing to go through some hoops. This question shows how.

I will illustrate for TeXShop:

  1. Type defaults find texshop | grep "keys in domain" at the bash prompt and inspect the results to learn the full name ("domain") of your application.

    % defaults find texshop | grep "keys in domain"
    Found 1 keys in domain 'com.apple.universalaccess': {
    Found 214 keys in domain 'TeXShop': {
    

    So the domain is just 'TeXShop'; other applications have dotted names with company domains, etc. (E.g., the domain for emacs is org.gnu.Emacs.)

  2. Create ~/Library/LaunchAgents/TexShop.plist. It needs to look like a specific XML template, which you'll find here. Edit it to add one or more launchctl setenv commands to be passed to TeXShop.

    launchctl setenv TEXINPUTS /home/alexis/Dropbox/texmf/tex
    
  3. Activate the new configuration with this command (from the bash prompt or from your .bash_profile).

    launchctl load ~/Library/LaunchAgents/Texshop.plist
    

    For some reason this gives me the message "service is already loaded", but without it TeXShop won't be able to see the environment variables I set. (Restart TeXShop after running this.)

Admittedly it seems simpler to just add a symlink in ~/Library, as Sergei Golovan suggested, but I wanted to use the environment.

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.