#lisp FAQ – How can I generate a standalone executable?


By following the instructions for your lisp implementation:

  • sbcl(sb-ext:save-lisp-and-die filename :executable t)
  • clisp(ext:saveinitmem filename :save-executable t)
  • OpenMCL(require "COCOA-APPLICATION")
  • ECL(c:build-program ...)
  • Allegro(generate-executable ...)
  • LispWorks(deliver ...)

These last two have a whole host of bells and whistles (including, in the case of LispWorks, a tree-shaker), but require the paid-for versions. (You should also check their royalty requirements.)


Why would you want to? Really? What commonly distributed systems in this day and age come in a single executable file, except as a delivery mechanism that subsequently sprays various libraries, databases and settings mechanisms around your filesystem?

8 Responses to “#lisp FAQ – How can I generate a standalone executable?”

  1. Pupeno says:

    I have just published an article covering the same issue on: http://pupeno.com/2007/08/26/the-problem-with-lisp except that I go with another viewpoint.

  2. splittist says:


    Thanks. From reading your entry and the comments (particularly yours) I don’t understand what you’re getting at: the example of a windows binary executable made from a lisp program (Edi’s Regex Coach) you immediately dismiss, although it seems to be exactly the sort of thing your wife could install and have a simple clickable icon on the desktop to run.

    And good luck delivering a Python, Objective-C, Haskell, Chicken Scheme, Erlang, Perl, or PHP application I can run on my Windows box without a raft of runtime infrastructure along with it. And I’m afraid the same goes for C, C++ and C# apps – there is a reason people talk about DLL-hell. I guess if I’m running precisely the same vanilla Ubuntu install as you I might be able to run a perl, ruby or python shebang-script without alteration. But I wouldn’t count on it.

    So – is there any lisp runtime that is as pervasive as, say, the GCC runtime? (But which version of GCC?) No. Would it be cool to have efficient tree-shakers for the ‘free’ lisps? Yes. But obviously Lisp has been used to distribute applications for decades, and continues to be so used. I really don’t think this is the showstopper you seem to think it is.

  3. ken says:

    “What commonly distributed systems in this day and age come in a single executable file?”

    Just about every Mac app does that. Well, looks like that, anyway — an .app is a bundle, but to the user it looks like a single file. If there was an easy way to build an .app bundle, that would be just as good, but there doesn’t seem to be. According to Bill Clementson, with OpenMCL, for example, “app bundles … need to be recompiled for every point update of Mac OS X. This effectively prevents distribution of finished apps”. Gong!

    “And good luck delivering a Python […] application I can run on my Windows box without a raft of runtime infrastructure along with it.”

    I’ve seen .exe’s built with py2exe that do just that. Way less painful than the typical Windows Installer mess.

    Being unable to distribute a single .exe isn’t a showstopper, by itself. Syntax that looks funny to most programmers isn’t a showstopper, by itself. Being, ah, strongly encouraged to use a specific editor (though a great one at that!) isn’t a showstopper, by itself. But you start stacking 5 or 6 of these minor-nits together, and people start saying “You know, Lisp may be really awesome, but Python is 90% as great and won’t beat me up along the way”.

    I love Lisp, but I fail to see how it helps anybody when people repeatedly ask for specific features and we repeatedly give them less-than-helpful answers. If the answer to “How do I make a single .exe?” was “You probably don’t want to, but here’s how to make a .msi installer…, and here’s how to make a Mac .app…”, that would be one thing — but it always seems to be “You probably don’t want to. *crickets*”.

  4. It’s (ext:saveinitmem filename :executable t) for CLISP.

  5. Flatlander says:

    FWIW I have found that distributing SBCL apps under Windows is quite easy, in many ways easier than using ‘traditional’ batch compilers. Since all the necessary information is held in .asdf and .lisp files I can just get the sources from my linux box and build a working win executable with a single command.
    And altough I usually use the :executable flag to wrap everything in a single .exe file it is not really that necessary since most apps need foreign .dll’s and other data files anyway. Installer files that puke their contents in app’s directory are the norm on Windows anyway.
    Only thing near to a showstopper is the huge size of the executable, starting from ~8mb when zipped…

  6. splittist says:

    @Timofei Shatrov

    Doh! Fixed. Thanks.

  7. Faré says:

    cl-launch will make an executable for you, standalone or not depending on whether your implementation supports it. At least ECL supports it.

  8. aspeneUsene says:

    omg.. good work, dude

Leave a Reply