# How do I use my .bib file with TexShop

I am completely new to using LaTex (I just started a week ago), and I'm using the templates posted on this website. I downloaded all the files, including the .bib file and the .cls file and they are all in the same directory. I am able to compile and display the .tex file, but when it appears, all citations have a [?] in them.

I'm not sure what I'm supposed to do. I'm sure there's a step I'm missing... perhaps there is a special way to use TexShop to make it work? Or am I supposed to use another program? Any help would be greatly appreciated.

• Note that for `.bib` files, you need to compile using the sequence: `latex file`, `bibtex file`, `latex file` (and possibly another `latex file`). `latex` can also be substituted with `pdflatex` or `xelatex` (depending on your compiler). Apr 11 '12 at 3:32
• This works fine for me tex.stackexchange.com/a/515807/200866 Nov 10 '19 at 12:07

To get proper citations using TeXShop you need to (at least):

1. Run LaTeX
2. Run BibTeX
3. Run LaTeX
4. Run LaTeX

LaTeX and BibTeX are selected in the drop-down box next to the "Typeset" button.

Assuming that everything else is correct (packages, .bib file, citation commands), this should give proper citations.

edit: Added an extra LaTeX run after running BibTeX as noted in the comments.

• You should usually run `latex` twice after running `bibtex`. See Undefined citation warnings. Apr 11 '12 at 11:07
• Wow! Thank you so much!!! I didn't realize that I had to compile both the .tex and .bib files. After a few tries, it seems like I need four steps: Latex File, Bibtex file, Latex File, Latex File (again).
– Paul
Apr 11 '12 at 14:10
• SORCERY! This works. =) Dec 14 '19 at 19:50

I am also new to Latex and was having this problem while using TexShop on Mac OS X. I second what's been said above: you need to run Latex, then Bibtex, then Latex twice. Also: you need to ensure that the file name of the .bib file is the same as the .tex file, and in the same directory. You do not need to specify the whole file directory path in the \bibliography{} command, just the file name e.g. \bibliography{my bib.bib} if it is in the same directory as the .tex file. After a lot of tinkering, I've got it to work!

• I don't think the `.bib` file must have the same name as the `.tex` file, putting the correct name in `\bibliography{...} ` is enough. Feb 23 '17 at 9:53
• Also, it's not necessary to include the extension `.bib` in the argument of `\bibliography`.
– Mico
Feb 23 '17 at 10:25

I'm using BibTex, Version 0.99d. In this version, it seems that the name of the .bib file must be the same with the latex file. So if you can't get the BibTex work, try to unify the name.

I use biber, i.e. `\usepackage[backend=biber]{biblatex}` and I also needed to change the BibTex Engine, which can be done in the TeXShop preferences:

TeXShop -> Preferences... -> Engine

Under BibTex Engine, type "Biber" and then ok.

Then proceed as JohnReed described: With Cmd + T to typeset and Cmd + shift + B to run biber.

I found a better alternative to running the script four times:

if you add the following comment as a very first line in your .tex file:

``````% !TEX TS-program = pdflatexmk
``````

⌘+T will make it work on the first try.