How do I add a .sty file to my MacTeX/TeXShop installation?
The first question you should ask is whether the package you are trying to install is already installed on your system. If you are using MacTeX as your distribution (which you probably are) then most packages are already available. Within TeXShop you can choose the "Show Help for Package" item from the Help menu and enter your package name. (Or make a simple document that loads the package to see if it doesn't exist.)
Installing packages or classes
If the package doesn't exist, then this answer:
- How to have local package override default package
covers everything you need to know.
On a Mac, local additions go into the Library/texmf
folder of your Home folder (~/Library/texmf
). Unfortunately on OS 10.7 and above, the user Library folder is typically hidden from view. It is, however, easy to access it through the Finder's Go menu: hold down the Option key while choosing the Go menu, and the local Library folder will appear in the list. Alternatively if you type Command-Shift-G you can enter the folder path directly (~/Library/texmf
)
You never need to update the file database for local additions to this folder.
If the texmf
folder doesn't exist, you will need to create it yourself along with the subfolders necessary for TeX to find things properly (see the linked question for the correct hierarchy). For a one-click version of this you can use this utility:
- Make Local texmf Folder (Disclaimer: I am the author of this).
Installing fonts for pdfLaTeX
Fonts which are to be used with pdfLaTeX should never be installed in this folder. See the following question for details about how to install fonts properly.
- Manual font installation
Installing fonts for XeLaTeX or LuaLaTeX
These fonts should not go in this folder either, but should be installed as system fonts in the same place that any font on your machine would go. On a Mac this is /Library/Fonts
.
To add cls package (like moderncv) in my OS distribution with texlive 2015, I just unzip package under /usr/local/texlive/2015basic/texmf-dist/tex/latex
.
Don't forget to run sudo texhash
!
Hope this help.
If you’re using BasicTeX (86 MB) instead of full-blown MacTeX (2.3 GB), e.g. to save valuable disk space on a MacBook Air, you’ll only find the most common packages and classes in your installation. To add more, the simplest option is the TeX Live Utility which you should find in your application folder. It also updates packages to the most recent version found on CTAN.
My /usr/local/texlive
folder structure currently weighs in at well below 400 MB.