Tag Archives: Mac

Lilypond, Latex and Texshop in Mac X 10.5

Supposing that you have a running version of Texshop, these are the steps you could follow to have lilypond and latex running in Texshop:

  1. Download and install lilypond (2.12.2) from http://lilypond.org/web/install/
  2. Download Nicola’s Lilypond – Latex engine for Texshop.
  3. Follow the instructions in the just downloaded script (basically, install the script at ~/Library/TexShop/Engines and give it execution permission).
  4. Edit this file so it looks like:
    # Create directory to put all temporary stuff
    mkdir -p “$1:r”-out/
    # Copy local style files, if any, where latex will be able to find them
    rm “$1:r”-out/*
    cp *.sty “$1:r”-out
    cp *.bbl “$1:r”-out
    cp *.aux “$1:r”-out
    cp *.cls “$1:r”-out
    if ({ lilypond-book –output=”$1:r”-out “$1″ }) then
    cd “$1:r”-out
    if ({ latex “$1″ }) then
    if ({ dvips -o -Ppdf -R0 “$1:r”.dvi }) then
    if ({ ps2pdf “$1:r”.ps }) then
    mv “$1:r”.pdf ..
    mv “$1:r”.aux ..

the rm command prevents lilypond to complain because it cannot overwrite files and keeps the size of the output directory small (Every time you compile something, new temporal files are created increasing the size of the directory unnecessarily). The ‘mv “$1:r”.aux’ keeps updated your references database, so you don’t get “Fig.??” or “Table ??”.

Also is a good idea to put something like


in the preamble to reflect the directory where your graphics are.

I find that when I’m working with Latex / Lilypond, the output is too slow sometimes, so my file looks something like this:
\setboolean{withLily}{true} % change to false if not working with Lilypond
\ifthenelse {\boolean{withLily}}
{} % The else statement.

And whenever I’m going to use lilypond, I embed it in the same conditional (The else statement, even if empty is important to keep).

If I’m only producing the text and reviewing the results, I use Latex as usual turning the variable false. The speed of the compilation is much faster that way.