# Adding a CTAN package to a MacPorts-maintained TeX installation

I have installed TeXlive through MacPorts and now discover that I am missing some package. For clarity let's use a trivial example and say I am missing lipsum.sty.

I now have two options:

Option 1

I go to a CTAN site, look for lipsum.sty, download it, and install it in `~/Library/texmf/tex`.

This is not bad, but it leaves it possible that I will end up with a second lipsum at some point. That's why the second option is desirable.

Option 2

2.1-- I find out which MacPorts package includes lipsum.sty

and

2.2-- I `sudo port install` the necessary package.

How do I do 2.1?

-
For me its under `/usr/local/bin/tlmgr`, but that's Linux. Don't you have `which` on Mac? – Martin Scharrer Apr 2 '12 at 15:39
yes, yes, of course. – Calaf Apr 2 '12 at 15:47
@MartinScharrer MacPorts is Mac-specific way of dealing with Unix ports. It places everything in `/opt/local`, leaving `/usr/local` alone. – Alan Munn Apr 2 '12 at 15:52
@Calaf I hate to say this, but is there a reason to use MacPorts and not the (de facto) standard MacTeX distribution? It will probably save you headaches in the future. – Alan Munn Apr 2 '12 at 15:53
Previous comment aside, you can always put packages from CTAN in `~/Library/texmf`. This will not affect your MacPorts distribution at all. The local files will be found first. – Alan Munn Apr 2 '12 at 15:56

## 3 Answers

Your question is a good one, but reveals one of the fundamental flaws in the way Linux-like (and I include here MacPorts) package management systems work when it comes to TeX distributions. The problem is that packages (in the TeX sense) are qualitatively different from packages in the Linux sense, but the Linux packagers don't seem to recognize the distinction, and so you are left with a situation in which if you use a Linux-based distribution of TeX, you are usually left with no simple way to update the TeX packages.

The qualitative difference between a TeX package and a regular software package is that TeX packages are simple text files which are not compiled and in fact not executable. A regular software package, on the other hand is usually a compiled piece of software or a bunch of scripts. Now of course in a TeX distribution as a whole, there are definitely compiled binaries and scripts, but these are not the pieces that are updated so frequently as TeX packages since, generally they are updated only once a year anyway. But new TeX packages and updates to existing ones happen all the time, and TeXLive (and MikTeX) users have constant access to these updates.

So an ideal Linux-based package would install only the TeX binaries and support software, including `tlmgr` and then allow `tlmgr` to deal with the installation of the TeX packages, rather than have the Linux package manager do this. However, for reasons that are not entirely clear to me, this is not the route that Linux based systems have taken (thus leading to many outdated TeX distributions; Ubuntu is a known culprit in this respect.) Since this is not the case, most experienced TeX users install their own version of TeXLive and bypass the package manager; (see How to install "vanilla" TeXLive on Debian or Ubuntu?) similarly Mac users use the MacTeX distribution.

MacPorts does seem to be keeping up-to-date, but unless it recognizes the "TeX-package" vs. "Linux-package" distinction and actually installs `tlmgr` I don't think there is a way to answer your question 2.2.

There is one possibility, I suppose: install both the MacPorts version and MacTeX and then make sure the TeX packages in `/usr/local/texlive` are found even if the MacPorts binaries are used.

-
I fully agree. MacTeX is the TeX distribution for Mac OS X. – egreg Apr 2 '12 at 20:50

Option 2

2.1: Go to packages.ubuntu.com, look for "Search the contents of packages", enter `lipsum.sty` and press search.

The result:

2.2: `sudo port install texlive-latex-extra`

I used to hate MacPorts for its limited search capabilites until I figured out that in 99 percent of all cases the MacPorts packages are named identically to the respective Ubuntu packages. This does not only hold if one looks for LaTeX stuff, but basically anything: Someone recommended `pdfnup` to generate slide handouts and you want to get that for your Mac? Just enter it in "Search the contests of packages" and you will figure out that the MacPorts package to install is `pdfjam`.

-

`lipsum` is part of the package `texlive-latex-extra`. You can install by

```sudo port install texlive-latex-extra
```

You can find the package that you need by indexing the name in https://trac.macports.org/wiki/TeXLivePackages

-