Latex can’t find .sty with TEXINPUT exported

macpathstexinputs

My LaTeX document starts with this: \RequirePackage{mymacros}

mymacros.sty is located in a completely different dir. Following this guide which says I should export TEXINPUTS, I've added this line to my .bashrc:

export TEXINPUT=.:/Users/myname/Documents/GitHub/latex-styles/:$TEXINPUTS

i.e. where mymacros.sty is located.

Then I run latex myfile.tex, but I get ! LaTeX Error: File 'mymacros.sty' not found.

I don't want to store the .sty file adjacent to the LaTeX file, because I want multiple files in different dirs to be able to use the .sty file.

I've tried changing the singular TEXINPUT to TEXINPUTS in case that was the problem, but that resulted in the same error.

I'm running MacOS and my LaTex version is shown here:
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=latex)

Best Answer

On MacOS, the simplest approach is to put the files in ~/Library/texmf/tex or its subdirectories. If for whatever reason you want to keep the files elsewhere, what I do is I open a terminal window, go to ~/Library/texmf/tex (creating the directories if necessary) then

ln -s path/to/other/input/directory