I am using asymptote to generate lots of images in a LaTeX document. The images are translated from asymptote to PDF as this:

pdflatex text.tex
asy text-*.asy
pdflatex text.tex

However, asymptote insists in opening a window, (which briefly flashes and goes away, without any content). Because of that I cannot compile my document from a remote machine using ssh:

asy x.asy
freeglut (asy): failed to open display ''

Is there a way to run asymptote in some mode that does not require a window system (without a defined DISPLAY in Unix)?

I have already tried -noView and -nointeractiveView, but Asymptote will still try to open a window.

  • Try asy -noView text-*.asy
    – egreg
    Commented Aug 12, 2015 at 17:31
  • egreg: thanks, but even with -noView it tries to use the display...
    – Jay
    Commented Aug 12, 2015 at 17:44
  • nordev: it also complains about not being able to "open display ''"
    – Jay
    Commented Aug 12, 2015 at 18:12

2 Answers 2


Asymptote has disabled offscreen rendering by default. To enable this feature, pass the -offscreen option to asy:

asy -offscreen text-*.asy

Alternatively you can create a config.asy configuration file and include the following:

import settings;

Looks like things have changed, the first method (-offscreen) in the other answer will be interpreted as -o ffscreen i.e. output to a file named ffscreen.eps or ffscreen.pdf.

The second method settings.offscreen just doesn't work.

One option is to build asymptote from source with --enable-offscreen instead .

Unfortunately, for me, offscreen OSMesa has some unknown issue -- https://github.com/vectorgraphics/asymptote/issues/392 has the detail.

So, another option is to run a headless/virtual X server.

  • First, run Xvfb :1 to start a virtual X server, listen for connections at server number 1.
  • Then, tell Asymptote which display to use: DISPLAY=:1 asy a.asy or asy --glOptions="-display :1" a.asy both works.

Remark: the (not very well-documented) option -glOptions pass the options to glutInit().

Note that Xvfb appears to not use GPU, so rendering can be slower. You may also take a look at https://superuser.com/a/503355/577463 for other options of headless X servers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .