Installing SBCL, Emacs, and SLIME on Windows XP

My recent install guide for CLISP, Emacs, and SLIME on Windows XP was a big hit – it has had about 2000 hits and 5 sincere thanks in the comments (it even got praise from a troll!). In it I promised a similar guide for SBCL, and here it is.

The nice thing is that swapping out Common Lisp implementations within an Emacs/SLIME setup is easy, so maybe 3/4 of this guide is identical to the CLISP guide. I’ll put a disclaimer at the beginning of each section saying whether there’s anything new or whether you can skip it.

0. Files to Download [DIFF: The only difference is the link to the SBCL installer instead of the CLisp installer]

If you want to get started on downloading the setup files, here are the links:

1. Setup Directories [NO DIFF: skip if you’ve completed the CLisp guide]

Windows XP loves extremely long pathnames like C:\Documents and Settings\Username\Application Data. This is okay if for GUI-driven apps, but in Emacs, you\’re not clicking, you\’re typing, and you want short path names. Also, much (most?) of the open source Common Lisp tools are developed on *nix, so there\’s less impedance mismatch when using stuff off the net if you have a *nix-ish folder structure.

Start with a root folder. In the pathnames in the rest of this guide, I\’ll refer to it as [HOME]. I used C:\home\ to match the *nix convention of having user files be in /home/username/. You also need a username directory – I called mine peter and I\’ll refer to it as [USR]. So in my case, [HOME]/[USR] would be C:\home\peter\.

Emacs NOTE #1: One important point about filenames in Emacs is that they CAN be entered with ‘/\’, but if you prefer to use ‘\\’, you have to escape it with another back slash, so in Emacs buffers and files, you would enter “C:/home/” or “C:\\home\\” but never “C:\home\”. The trailing slash is also important because it indicates that it\’s a directory. Now that you have chosen your [ROOT] and [USR] values, these are the folders you should setup:

  • [HOME]\[USR]\
  • [HOME]\[USR]\site\
  • [HOME]\[USR]\docs\
  • [HOME]\[USR]\lisp\
  • [HOME]\[USR]\info\
  • [HOME]\bin\

2. Setup Emacs [NO DIFF: skip if you’ve completed the CLisp guide]

Emacs does not need to be “installed” like most Windows apps – it just runs from its directory. Extract it to [HOME]\bin\. I changed the folder name from emacs-22.2 to just emacs, so my path was c:\home\bin\emacs\. You run emacs by running the file [HOME]\bin\emacs\bin\runemacs.exe.

Emacs settings are stored in a configuration file called “.emacs”. On Windows, the default working folder and .emacs location is C:\Documents and Settings\Username\Application Data, but that\’s too painful to type and it\’s a hidden folder so it\’s not even easy to get through with the GUI. To have Emacs work in a different folder, create a file called site-start.el in the emacs\site-lisp folder. In that folder, put the following line (but change the path to match yours):

(setenv “HOME” “[HOME]/[USR]/”)

(Thanks Nathaniel! This was probably the biggest annoyance of mine that made me put off finishing setup for so long.)

Emacs NOTE #2: Emacs has lots (and lots and lots) of keyboard shortcuts, many more than there are letters in the alphabet. Many of them require multiple keys or a sequence of keys called a “chord”. The two modifier keys used are Control and Alt (also called Meta). The common way to write chords is to use C- and M- for Control and Meta, so to run the command to close Emacs, you hold down Control and X, then let go, then hold down Control and C. This is written as C-x C-c. Sometimes a chord is followed by another letter or the name of a command. For instance, to undo, you hold Control and x, then let go and hit u. This is written as C-x u. Dashes mean press at the same time, space means let go. Easy! I made a cheat sheet for common commands in Emacs and SLIME.

Now it\’s time to create your .emacs file. Run emacs and hit C-x C-f. This is the find command, which is used to create or open a file. At the prompt “Find file: “, type “~/.emacs” (without quotes). Right now just put a ; (that\’s the comment marker in Emacs Lisp files) and save it by hitting C-x C-s. There\’s a world of stuff you can put in a .emacs file, but that\’s too much to bite off now.

3. Install SBCL [DIFF: This section is completely different]

Although the Windows port of SBCL is still experimental, there is a Windows installer (.msi) file for v1.0.13 (highest version as of now is v1.0.17). Just run the installer, and install it to the directory:


Then just finish the install wizard. But you’re not finished yet.

Robert Zubek wrote a post about 2 months ago about how to setup SBCL/Emacs/SLIME on Vista, but it doesn’t work exactly right on Windows XP. If you use the .emacs settings from his post, you get this error when you start SLIME (instead of using the .emacs settings in step 4):

fatal error encountered in SBCL pid XXXX:

can’t find core file at /user/local/lib/sbcl//sbcl.core

Process inferior-lisp exited abnormally with code 1

If you use the settings in step 4, you’ll get a different error message:

Searching for program: no such file or directory, sbcl

If you SBCL looks in the environment variable PATH to find the executable and core file. The default directories are *nixy, so it won’t find your sbcl directory on accident. But why should it look for the directory if you entered it into the install wizard?

Apparently Windows XP doesn’t update system environment variables until the system reboots. So right after you install SBCL, you have the user environment variables PATH and SBCL_Home but SBCL looks in the system variables. I couldn’t find out a way to fix that without rebooting, but the good news is that a reboot solves the problem.

So reboot your computer now.

4. Setup SLIME [DIFF: This section has some differences – links and .emacs setup]

Apparently the SLIME 2.0 is very old; several people recommend ignoring it and going straight to the CVS snapshot, so that’s what I linked to above.

Extract the SLIME folder to [HOME]\bin\emacs\site-lisp. (Here\’s a tip about putting emacs code in site-lisp).

Now in Emacs, open your .emacs file (C-x C-f, ~/.emacs) and enter the following (general SLIME instructions, SBCL specific setup), changing your pathnames as usual. The good news is that because SBCL looks in the environment variables, you don’t need any of the command line parameters in the inferior-lisp-program variable:

(setq inferior-lisp-program “sbcl”)
(add-to-list ‘load-path “[HOME]/bin/emacs/site-lisp/slime/”)
(require \’slime)

Save the .emacs file (C-x C-s), then run the eval-buffer command (M-x eval-buffer). This will run the code that you just entered and tell Emacs how to run SLIME.

Now, you start slime with M-x slime and you\’re ready to go!

NOTE: This is a basic SBCL setup – I’ve found some more advanced setup links that I’ll write guides for later:

Additional comments at comp.lang.lisp.


  1. says

    Does Emacs have problems parsing the spaces in Windows paths like XEmacs does? If so, this is a fly in the ointment that people should be aware of… See R. Zubek’s post referenced above.

  2. says

    Not sure about filenames with spaces. I tried a couple things at the minibuffer and there was no problem. I don’t want to change my install directories (because writing these thing is a pain enough) so if anyone wants to experiment with installing SBCL to a filename with spaces, please let me know how it goes!


  3. says

    Note that it’s not really necessary to add SBCL_Home to path.
    There is a weird limit on %PATH% length, so my approach was to create sbcl.cmd with full paths, like:

    d:\usr\local\sbcl\sbcl.exe –core d:\usr\local\sbcl.core

    and to supply this .cmd as inferior-lisp to emacs

  4. says

    Do you have any plans on adding instructions for ASDF configuration? Next to installing a CL and Emacs/Slime, this was probably the next hardest part when I was starting to learn CL.

    My personal advice would be to add

    (require ‘asdf)

    ;; Add any directories in asdf to the registry
    (dolist (dir (directory “/path/to/asdf-central-repository/*/”))
    (pushnew dir asdf:*central-registry* :test #’equal))

    to your .sbclrc, which should be placed in the directory specified by (user-homedir-pathname). That way, you can just extract (or darcs get) a library into that folder and not have to worry about adding links to the .asd files (which may not work on Windows anyways).

    There is also an alternative function at under “Alternative Sysdef Search functionality” in case the wildcard in the argument to directory doesn’t have the desired effect (e.g. Allegro).

  5. says

    Also, your SLIME configuration works, but there are some new features in CVS which you haven’t used (see For example, instead of

    (setq inferior-lisp-program “sbcl”)

    you could use

    (setq slime-lisp-implementations
    `((clisp (“clisp” “-K” “full”))
    (sbcl (“sbcl”))))

    which (assuming you have both CLISP and SBCL installed and in your PATH) runs CLISP by default when you type “M-x slime”, but also allows you to type “M-1-x slime sbcl” to run SBCL.

    Furthermore, you could define two functions

    (defun clisp ()
    (slime ‘clisp))

    (defun sbcl ()
    (slime ‘sbcl))

    which would allow you to type “M-x clisp” and “M-x sbcl” to start CLISP and SBCL, respectively.

    And if you decided that you just didn’t like typing at all, you could

    (global-set-key [f5] ‘clisp)
    (global-set-key [f6] ‘sbcl)

    so that just pressing “f5″ or “f6″ would start CLISP or SBCL.

    Enjoy :-)

  6. says

    Oh, and one more thing that you might want to try is Paredit (,which makes typing all those parens a LOT easier.

    Just download the file, and drop it in your /path/to/emacs/lisp/ directory. Then add the following to your .emacs

    (autoload ‘paredit-mode “paredit”
    “Minor mode for pseudo-structurally editing Lisp code.”
    (add-hook ‘lisp-mode-hook (lambda () (paredit-mode +1)))

    Then when you open a lisp file and type “(” you should get a “)” with no extra typing.

    See for a complete list of Paredit commands.

    Enjoy :-)

  7. Nelson says

    Following the instructions, I am unable to get SBCL to run. When launching slime I get the following start up error:

    (progn (load “d:/home/bin/emacs/site-lisp/slime/swank-loader.lisp” :verbose t) (funcall (read-from-string “swank-loader:init”)) (funcall (read-from-string “swank:start-server”) “d:/DOCUME~1/e127778/LOCALS~1/Temp/slime.3684″ :coding-system “iso-latin-1-unix”))

    VirtualAlloc: 0x1e7.
    ensure_space: failed to validate 536870912 bytes at 0x09000000
    (hint: Try “ulimit -a”; maybe you should increase memory limits.)

    Process inferior-lisp exited abnormally with code 1

  8. __Mario__ says

    Edit src/compiler/x86/parms.lisp, find the section for your OS and change one of the lines to read:

    (def!constant dynamic-space-end #x10000000)

    Hope that helps !

    — Mario

  9. Tony says

    I’m using XP, Slime, Emacs, SBCL and I’m having an error based on my misunderstanding of setting the correct path. I’m new to XP and finding the .emacs file in the Applications Data directory was a little strange. My problem has to do with the loading of Slime. In my .emacs I defined the full path name rather than sbcl. Could it be choking on something in the long path?

    when I M-x slime
    I get
    apply: Spawning child process: invalid argument
    My .emacs is

    (setq inferior-lisp-program “c:/Program Files/Steel Bank Common Lisp/1.0.37/sbcl”)
    (add-to-list ‘load-path “c:/Program Files/slime/”)
    (require ‘slime)

    Great blog BTW

  10. Tony says

    As to

    I\’m using XP, Slime, Emacs …
    Great blog BTW

    It works without using the full path I amazed maybe I should stop hating XP, No that would be silly.

    Great Blog -f

  11. Jud says


    Thanks for sharing your knowledge. I have been trying to get SBCL/SLIME set up on Windows XP, and can get EMACS to work, but run into a problem with M-x slime, as below.

    This smells like a ridiculously simple problem, but one I do not know how to fix.

    I will really appreciate any help.


    (load “c:/home/bin/emacs/site-lisp/slime/swank-loader.lisp” :verbose t)
    (swank:start-server “c:/DOCUME~1/USER/LOCALS~1/Temp/slime.8068″ :external-format :iso-latin-1-unix)

    This is SBCL 1.0.37, an implementation of ANSI Common Lisp.
    More information about SBCL is available at .

    SBCL is free software, provided as is, with absolutely no warranty.
    It is mostly in the public domain; some portions are provided under
    BSD-style licenses. See the CREDITS and COPYING files in the
    distribution for more information.

    This is experimental prerelease support for the Windows platform: use
    at your own risk. “Your Kitten of Death awaits!”
    ; loading #P”c:\\home\\bin\\emacs\\site-lisp\\slime\\swank-loader.lisp”
    ;; loading #P”C:\\Documents and Settings\\USER\\.slime\\fasl\\2006-04-20\\sbcl-1.0.37-win32-x86\\swank-backend.fasl”
    ;; loading #P”C:\\Documents and Settings\\USER\\.slime\\fasl\\2006-04-20\\sbcl-1.0.37-win32-x86\\nregex.fasl”

    ; compiling file “c:\\home\\bin\\emacs\\site-lisp\\slime\\swank-sbcl.lisp” (written 19 APR 2006 06:18:54 PM):

    ; file: c:\home\bin\emacs\site-lisp\slime\swank-sbcl.lisp
    ; caught WARNING:
    ; (in macroexpansion of (SB-INTROSPECT:FUNCTION-ARGLIST FNAME))
    ; (hint: For more precise location, try *BREAK-ON-SIGNALS*.)
    ; compilation aborted because of fatal error:
    ; SB-INT:SIMPLE-READER-PACKAGE-ERROR at 31205 (line 793, column 39) on #:
    ; Symbol “DEBUG-SOURCE-FROM” not found in the SB-DI package.
    ; ; compilation aborted after 0:00:01.860

    debugger invoked on a SB-INT:SIMPLE-FILE-ERROR:
    Couldn’t load
    #P”C:\\Documents and Settings\\USER\\.slime\\fasl\\2006-04-20\\sbcl-1.0.37-win32-x86\\swank-sbcl.fas”l:
    file does not exist.

    Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

    restarts (invokable by number or by possibly-abbreviated name):
    0: [ABORT] Exit debugger, returning to top level.

    #P”C:\\Documents and Settings\\USER\\.slime\\fasl\\2006-04-20\\sbcl-1.0.37-win32-x86\\swank-sbcl.fasl”)[:EXTERNAL]
    0] swank-sbcl.fas C-c C-c
    Process inferior-lisp interrupt

  12. says

    To avoid “can\’t find core file at /user/local/lib/sbcl//sbcl.core” error, I have created a .cmd (aka batch) file in the same directory where sbcl.exe resides. It contains

    Rem SCBL launcher
    sbcl.exe –core sbcl.core

    Here sbcl.core and sbcl.exe both exists in the same directory.

  13. Tedd says


    I just ran into the exact same issue and was able to fix it. The problem is that the copy of slime that emacs was using was out of date. You can download a new one here:

    Then in your .emacs file update the load-path to point to where ever you have unpacked this latest copy of slime.

    Once I did that I was up and running in Emacs with slime using SBCL on WindowsXP.


    – Tedd

  14. Paul says

    Hi Peter
    just to thank you as well, found it relatively easy to set up.. Was using Lisp in a box a few years ago, but that has suffered from bit rot. Am using vista 64 bit, I used the msi installer for SBCL and it went into the C:\Program Files (x86)\Steel Bank Common Lisp\1.0.48> directory. Everything now working fine.
    Paul H

  15. Suraj Ravichandran says

    Hey, I am trying to put my system to work on windows 7.

    I followed your procedure and in the end when i enter slime in the meta-key space… it gives this output, please help

    (progn (load “c:/home/bin/emacs/site-lisp/slime/swank-loader.lisp” :verbose t) (funcall (read-from-string “swank-loader:init”)) (funcall (read-from-string “swank:start-server”) “c:/Users/suraj/AppData/Local/Temp/slime.4860″))

    validation of reserved space too short.
    VirtualAlloc: 0x1e7.
    ensure_space: failed to validate 1044480 bytes at 0x02100000
    (hint: Try “ulimit -a”; maybe you should increase memory limits.)

    Process inferior-lisp exited abnormally with code 1

  16. Dan Salmonsen says

    Thanks for putting this together, It is the only resource I have found that works as stated after many hours of searching, however, I did run into some snags. My first intro to lisp was via Clojure, but I wanted to back track a bit to Clojures roots and try some common lisp and found that emacs was the recommended way.

    After easily getting Clojure and Leiningen working with Slime and emacs via the emacs package manager and Marmalade, I tried using your procedure with a few “shortcuts” like assuming slime was already installed and all I had to do was install SBCL as shown here. I finally gave up that route after hours of trying and failing to get it working. I wiped everything and followed this procedure exactly and it worked for my Win 7 machine.

    Would it be possible to update this procedure to work with package manager and take advantage of some of the new behaviors of emacs 24.1?

    Also, I think a few check points along the way would help, such as

    Verify that emacs is using [home]\[user] path for the environment by checking for the creation of [home]\[user]\.emacs.d folder after emacs runs the first time.

    Verify that sbcl can be run in powershell from the [home]\[user] path. (won’t happen if you do not re-boot)

    I noticed that my emacs automatically included the slime path in load-path. I did not need to do (add-to-list ‘load-path “[HOME]/bin/emacs/site-lisp/slime/”)

    It would be nice to see some examples of how to use this setup to create, evaluate, and run some common lisp examples. I see the REPL and I of course can edit files in emacs, but there must be more to this than just doing that. Maybe even add in some of the packages that make editing pretty etc.

  17. Roel says

    @Tony, I’m having the same error: apply spawning child process: invalid argument.

    Have you figured out what has gone wrong yet?

  18. catdoc says

    i use xp and encounter the error:

    ; loading #P”c:\\home\\bin\\emacs\\site-lisp\\slime\\swank-loader.lisp”
    ; compilation unit aborted
    ; caught 1 fatal ERROR condition
    ; compilation aborted because of fatal error:
    ; READ failure in COMPILE-FILE:
    ; SB-INT:SIMPLE-READER-PACKAGE-ERROR at 15434 (line 442, column 36) on #:
    ; Symbol “VALID-TYPE-SPECIFIER-P” not found in the SB-EXT package.
    ;; Error while compiling c:\home\bin\emacs\site-lisp\slime\swank-sbcl.lisp:
    ;; couldn’t remove “C:\\home\\sky\\.slime\\fasl\\2013-02-13\\sbcl-1.0.13-no-threads-win32-x86\\swank-sbcl.fasl”:
    ;; Permission denied
    ;; Aborting.

    how to solve this?

  19. lilong says

    I’m using XP, Slime, Emacs, SBCL . My problem has to do with the loading of Slime.

    when I M-x slime
    I get
    apply: permission denied,lisp
    My .emacs is

    (setq inferior-lisp-program “sbcl”)
    (add-to-list ‘load-path “d:/Program Files/slime/”)
    (require ‘slime-autoloaders)

    how can i get the permission?

  20. lilong says

    I’m using XP, Slime, Emacs, SBCL . I’m new to emacs and finding the .emacs file in the Applications Data directory was a little strange. My problem has to do with the loading of Slime. In my .emacs

    when I M-x slime
    I get
    apply: permission denied,lisp
    My .emacs is

    (setq inferior-lisp-program “sbcl”)
    (add-to-list ‘load-path “d:/Program Files/slime/”)
    (require ‘slime)

  21. hajovonta says

    lilong: you did not follow the instructions in the blog post.

    Copy the entire directory of your slime from d:\Program Files\slime to the site-lisp directory of your emacs installation. Then edit your .emacs file (line starting with add-to-list ‘load-path… in the above) so that it points to the new directory. Then if you restart your emacs, it will have appropriate permissions and slime will be at the right place.

  22. Casey says

    Suraj Ravichandran, did you ever solve your problem on Windows 7? I am having the same difficulty.

  23. Mike Stramba says

    You don’t need to reboot to update environment variables in XP.

    Just start a new cmd shell ;)



Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>