# Where to place you own .sty or .cls files, to make them available to all my .tex files?

By | May 24, 2016

Suppose you have defined a package or a class, but how do you make it available at all times? One way is to just place it in the same folder as the .tex file, but that’s not what I’m after here. This post will tell you a way to “install” the package centrally on your computer.

1. Find out the directory. First, use this command at the command prompt to find out where your TeX home directory is.

```kpsewhich -var-value=TEXMFHOME
```
OS Location
Windows C:/Users/stefan/texmf
Unix-type ~/texmf/
Mac ~/Library/texmf

2. Place files in the “right place”. Following the TeX directory structure, you should place your file in the “right place” like `~/texmf/tex/latex/packagename/packagename.sty`. For a TDS-conformant system (TeX Directory Structure), the “right place” for a LaTeX .sty file is a suitably-named subdirectory of `texmf/tex/latex/`. For a full list of “right place”s, please see LaTeX/Installing Extra Packages. Moreover, for the `beamer` style, put the theme under `beamer/themes/` with “color”, “font”, “inner”, “outer”, and “theme” in seperated subdirectories.

3. Update your index. Finally, run your TeX indexer program to update the package database.

Version of TeX Program
teTeX, TeX Live, fpTeX texhash
web2c mktexlsr
MacTeX
MikTeX initexmf

I am using texlive, so I run

```texhash ~/texmf
```

This will generate a `ls-R` file in the directory.