Next: , Previous: Invoking lilypond, Up: Invoking LilyPond



5.2 Invoking the lilypond binary

The formatting system consists of two parts: a binary executable (lilypond-bin), which is responsible for the formatting functionality, and support scripts, which post-process the resulting output. Normally, the support scripts are called, which in turn invoke the lilypond-bin binary. However, lilypond-bin may be called directly as follows.

             lilypond-bin [option]... file...

When invoked with a filename that has no extension, the .ly extension is tried first. To read input from stdin, use a dash - for file.

When filename.ly is processed it will produce filename.tex as output (or filename.ps for PostScript output). If filename.ly contains more than one \score block, then the rest of the scores will be output in numbered files, starting with filename-1.tex. Several files can be specified; they will each be processed independently. 1

We strongly advise against making LilyPond formatting available through a web server. That is, processing input from untrusted users, and returning the resulting PDF file. LilyPond is a big and complex program. It was not written with security in mind. Making it available to the outside world is a huge risk; consider the security implications of

  #(system "rm -rf /")
  \score {
    c4^#(ly:export (ly:gulp-file "/etc/passwd"))
  }

5.3 Command line options

The following options are supported:

-e,--evaluate=expr
Evaluate the Scheme expr before parsing any .ly files. Multiple -e options may be given, they will be evaluated sequentially. The function ly:set-option allows for access to some internal variables. Use -e '(ly:option-usage)' for more information.
-f,--format=format
Output format for sheet music. Choices are tex (for TeX output, to be processed with plain TeX, or through lilypond), pdftex for PDFTeX input, ps (for PostScript), scm (for a Scheme dump), sk (for Sketch) and as (for ASCII-art).

This option is only for developers. Only the TeX output of these is usable for real work.


-h,--help
Show a summary of usage.
--include, -I=directory
Add directory to the search path for input files.
-i,--init=file
Set init file to file (default: init.ly).
-m,--no-paper
Disable TeX output. If you have a \midi definition MIDI output will be generated.
-M,--dependencies
Output rules to be included in Makefile.
-o,--output=FILE
Set the default output file to FILE.
-v,--version
Show version information.
-V,--verbose
Be verbose: show full paths of all files read, and give timing information.
-w,--warranty
Show the warranty with which GNU LilyPond comes. (It comes with NO WARRANTY!)

5.4 Environment variables

For processing both the TeX and the PostScript output, the appropriate environment variables must be set. The following scripts do this:

They should normally be sourced as part of the login process. If these scripts are not run from the system wide login process, then you must run it yourself.

If you use sh, bash, or a similar shell, then add the following to your .profile:

     	. /the/path/to/lilypond-profile

If you use csh, tcsh or a similar shell, then add the following to your ~/.login:

     	source /the/path/to/lilypond-login

Of course, in both cases, you should substitute the proper location of either script.

These scripts set the following variables:

TEXMF
To make sure that TeX and lilypond find data files (among others .tex, .mf and .tfm), you have to set TEXMF to point to the lilypond data file tree. A typical setting would be
          {/usr/share/lilypond/1.6.0,{!!/usr/share/texmf}}
     

GS_LIB
For processing PostScript output (obtained with -f ps) with Ghostscript you have to set GS_LIB to point to the directory containing library PS files.
GS_FONTPATH
For processing PostScript output (obtained with -f ps) with Ghostscript you have to set GS_FONTPATH to point to the directory containing PFA files.

When you print direct PS output, remember to send the PFA files to the printer as well.

The binary itself recognizes the following environment variables:

LILYPONDPREFIX
This specifies a directory where locale messages and data files will be looked up by default. The directory should contain subdirectories called ly/, ps/, tex/, etc.
LANG
This selects the language for the warning messages.


Footnotes

[1] The status of GUILE is not reset across invocations, so be careful not to change any system defaults from within Scheme.


Read comments on this page, or add one.

This page is for LilyPond-2.2.6 (stable-branch).

Report errors to <bug-lilypond@gnu.org>.