LilyPond “hello, world!”

Working with Abjad means working with LilyPond.

To start we’ll need to make sure LilyPond is installed.

Open the terminal and type lilypond --version:

$ lilypond --version
GNU LilyPond 2.17.3

Copyright (c) 1996--2012 by
  Han-Wen Nienhuys <>
  Jan Nieuwenhuizen <>
  and others.

This program is free software.  It is covered by the GNU General Public
License and you are welcome to change it and/or distribute copies of it
under certain conditions.  Invoke as `lilypond --warranty' for more

LilyPond responds with version and copyright information. If the terminal tells you that LilyPond is not found, then either LilyPond isn’t installed on your computer or else your computer doesn’t know where LilyPond is installed.

If you haven’t installed LilyPond, go to and download the current version of LilyPond for your operating system.

If your computer doesn’t know where LilyPond is installed, then you’ll have to tell your computer where LilyPond is. Doing this depends on your operating system. If you’re running MacOS X or Linux, then you need to make sure that the location of the LilyPond binary is present in your PATH environment variable. If you don’t know how to add things to your path, you should Google or ask a friend.

Writing the file

Change to whatever directory you’d like and then use your text editor to create a new file called

Type the following lines of LilyPond input into

\version "2.17.3"
\language "english"

\score {

Save and quit your text editor when you’re done.

Note the following:

  1. You can use either spaces or tabs while you type.
  2. The version string you type must match the LilyPond version you found above.
  3. The English language command tells LilyPond to use English note names.
  4. The score block tells LilyPond that you’re entering actual music.
  5. The expression c‘4 tells LilyPond to create a quarter note middle C.
  6. LilyPond files end in .ly by convention.

Interpreting the file

Call LilyPond on

$ lilypond
GNU LilyPond 2.17.3
Processing `'
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Layout output to `'...
Converting to `./hello_world.pdf'...
Success: compilation successfully completed

LilyPond reads as input and creates hello_world.pdf as output.

Open the hello_world.pdf file LilyPond creates.

You can do this by clicking on the file. Or you can open the file from the command line.

If you’re using MacOS X you can open hello_world.pdf like this:

$ open hello_world.pdf

Your operating system shows the score you created.

Repeating the process

Working with LilyPond means doing these things:

  1. edit a LilyPond input file
  2. interpet the input file
  3. open the PDF and inspect your work

You’ll repeat this process many times to make your scores look the way you want. But no matter how complex your music this edit-interpret-view loop will be the basic way you work.