TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've searched online, but I have not found any clear instructions how to permanently add .sty files to my TeXShop installation. I'm using a Mac with OSX (TeXShop is a mac only program).

What is the best way of doing this? The one comprehensive set of instructions I found here.

I've got as far as extracting the files (running LaTeX on the .ins and . dtx files) but after that I don't know what to do. I also don't understand how to update the index of my distribution, and whether there are particular OSX specifics (the instructions are for Windows).

share|improve this question
    
Are you sure the package isn't already on your system? If it's from CTAN, then it most likely is. – Alan Munn Feb 4 '11 at 15:02
up vote 39 down vote accepted

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.)

If the package doesn't exist, then this answer:

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:

share|improve this answer
    
Perhaps you should mention something about the TDS... – Seamus Feb 4 '11 at 15:09
1  
@Seamus that's what the linked answer is. – Alan Munn Feb 4 '11 at 15:46
3  
Alternatively to permanently unhide your ~/Library directory on 10.7 (Lion), simply run chflags nohidden ~/Library/ in Terminal. :-) – user2473 Jan 26 '12 at 0:26
    
For Mac OS 10.7, I recommend XtraFinder, which works on top of the Finder, and which has the option View -> Show Hidden Items – PatrickT Feb 15 '14 at 7:04
1  
Amazing, ur app really works and helps!!!! – Charles Yan Jun 9 at 15:13

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.

share|improve this answer
1  
I'm afraid this approach will not work under "El Capitan", the latest OSX flavor. – atmosx Oct 2 '15 at 5:38
2  
Is there a particular reason? – gregmacfarlane Dec 11 '15 at 15:16
1  
Just to clarify the comments, this method will absolutely work with El Capitan. – Alan Munn Jun 4 at 20:03

How to put .sty and .cls Files where TexShop will find them:

Personalised sty files are stored in ~/Library/texmf/tex/latex.

The folder ~Library is a hidden folder. In Finder, click on your home folder in the Finder directory tree on the left hand panel of the Finder.

Next, the hidden folders then need to be made visible. This is done from a terminal. The terminal should open by default in your home folder.

Type into the command line:

defaults write com.apple.finder AppleShowAllFiles YES

followed by

killall Finder

The hidden files in you home folder should now be visible.

Choose the Library folder, then texmf, then tex, then latex. The sty files, or folders contain sty and cls files, can be placed into this folder.

Next, we need to make the hidden files invisible again. To do this, type into the terminal:

defaults write com.apple.finder AppleShowAllFiles NO

Then type

killall Finder

The hidden folders should now no longer be visible.

share|improve this answer
    
Welcome, using a terminal to make folders visible, move files, make folders unvisible again? Wow, OS X is complicated. Can't you just mv the files in your terminal? A decent bash will show you everything with the very simple ls -a. – Johannes_B Jun 4 at 12:09
    
This really is not necessary. You can access hidden folders from the Go menu (see my answer for how). Also, once you've unhidden the folders, there's really no need to hide them again. Furthermore, since unhiding the Library is a generally useful thing, rather than unhiding all hidden files, it's better to selectively unhide the Library folder only by using chflags nohidden ~/Library/. – Alan Munn Jun 4 at 20:02
    
@Johannes_B: that can be done on the Mac too. Under Yosemite and later you can also make it permanently visible in Finder by simply opening the HOME folder, typing Cmd-J and choosing to make it visible. From then it's visible in the HOME folder. – Herb Schulz Jun 8 at 0:47

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.