# Installing TeX packages

Often it is convenient to install extra tex packages. We strongly recommend you use `tlmgr` for this where possible. For example to install a package named `somepackage` you would type either

    tlmgr install somepackage

or

    sudo tlmgr install somepackage

into your Terminal window. This will download and install the package, rebuilding caches and altering config files where necessary.

## Manual installation

If the package is not available via `tlmgr` then after emailing the package author to suggest they make it available that way you have two options

- If you are using them on a one off basis you can install them in the same folder as the root tex file. TeX searches this location first, so it will be found
- If you want to use it repeatedly, then the best option is to install it in the `texmf` folder and it will be available to all documents

### texmf installation

Normally, there is a texmf/tex directory in your Library folder. This is hidden by default on OSX, so to ensure it exists and open it, please type the following into the

    mkdir -p ~/Library/texmf/tex
    open ~/Library/texmf/tex

### finding all texmf directories

With some TeX distributions, the folder suggested above may not work. To find out the full list of paths searched by tex, you can type the following command in a Terminal window

    kpsewhich --show-path tex

# Installing bibliography files

To install bibliography files and bibliography style files replace `tex` with `bibtex/bib` and `bibtex/bst` in the above instructions. Type the following into Terminal

    mkdir -p ~/Library/texmf/bibtex/bib
    mkdir -p ~/Library/texmf/bibtex/bst
    open ~/Library/texmf/bibtex

And to find bibliography search paths, type the following commands into a Terminal window

    kpsewhich --show-path bib
    kpsewhich --show-path bet