sbcl
Run the Steel Bank Common Lisp compiler
TLDR
Start a REPL (interactive shell)
Execute a Lisp script
SYNOPSIS
sbcl [OPTIONS] [ARGUMENTS...]
PARAMETERS
--version
Prints SBCL's version string and exits.
--help
Prints a summary of command line options and exits.
--core <file>
Uses the specified core file instead of the default sbcl.core. A core file contains the Lisp runtime environment and often preloaded libraries.
--no-userinit
Prevents loading the user's ~/.sbclrc initialization file, which typically contains user-specific Lisp configurations.
--no-sysinit
Prevents loading the system's sbclrc initialization file, often located in /etc/sbclrc or similar paths.
--disable-debugger
Disables the debugger. When an error occurs, SBCL will exit immediately instead of entering the debugger, which can be useful for automated scripts.
--dynamic-space-size <megabytes>
Sets the initial size of the dynamic memory space (heap) for Lisp objects in megabytes. This space is managed by the garbage collector.
--control-stack-size <megabytes>
Sets the size of the control stack in megabytes. This stack is used for function calls and local variables.
--without-threads
Runs SBCL without multi-threading support. This option is only effective if SBCL was built with optional thread support and is useful for specific debugging or deployment scenarios.
--end-runtime-options
Marks the end of SBCL's command-line options. Any subsequent arguments are passed directly to the Lisp program and can be accessed via the *posix-argv* variable.
--non-interactive
Does not enter the interactive REPL (Read-Eval-Print Loop) after processing other options. SBCL will exit after executing any specified --load or --eval forms.
--quit
Exits SBCL after processing all other command-line options and any loaded/evaluated Lisp code. Often used in conjunction with --eval or --load for one-off tasks.
--eval <form>
Evaluates the given Lisp form. This option can be used multiple times; forms are evaluated sequentially in the order they appear on the command line.
--load <file>
Loads and executes the specified Lisp file. This option can be used multiple times; files are loaded sequentially in the order they appear.
--script <file>
Loads the specified Lisp file and then exits, similar to --load combined with --quit and --non-interactive. All subsequent command-line arguments are passed to the Lisp program via *posix-argv*, making it ideal for creating executable Lisp scripts (e.g., using a shebang line).
--sysinit <file>
Loads the specified system-wide initialization file instead of the default system sbclrc.
--userinit <file>
Loads the specified user initialization file instead of ~/.sbclrc.
DESCRIPTION
SBCL (Steel Bank Common Lisp) is an open-source, high-performance Common Lisp implementation widely used in the Lisp community. It is renowned for its optimizing native code compiler, which translates Lisp code directly into machine code for various architectures, resulting in fast execution. SBCL provides a comprehensive interactive development environment (REPL - Read-Eval-Print Loop), a powerful debugger, and a robust foreign function interface (FFI) for interoperability with C and other languages.
Adhering strictly to the ANSI Common Lisp standard, SBCL offers multi-threading support, a powerful object system (CLOS), and extensive libraries. Its stability, performance, and rich feature set make it a reliable choice for diverse applications, ranging from scripting and prototyping to complex systems and scientific computing.
CAVEATS
Memory Usage: Lisp images can consume significant memory, especially for larger applications, due to garbage collection and the runtime environment. Users should be mindful of the dynamic space size configuration.
Startup Time: While highly optimized, the startup time for SBCL can be slightly noticeable for very small, frequently executed scripts compared to shell scripts or other compiled languages, due to the loading of the Lisp image.
Lisp Learning Curve: Common Lisp itself, upon which SBCL is built, has a significant learning curve, especially for developers unfamiliar with its syntax, paradigms (e.g., macros, CLOS), and dynamic nature. This is a general ecosystem consideration, not specific to SBCL's implementation quality.
REPL (READ-EVAL-PRINT LOOP)
SBCL's interactive REPL is fundamental to Common Lisp development. It allows users to experiment with code, inspect objects, and debug programs incrementally in a dynamic and interactive environment, promoting rapid prototyping and exploration.
FOREIGN FUNCTION INTERFACE (FFI)
SBCL includes a powerful FFI that allows Lisp code to seamlessly call functions in shared libraries written in C, C++, or other languages, and vice versa. This enables robust integration with existing system libraries and external components, extending Lisp's capabilities.
IMAGE DUMPING
SBCL can 'dump' its current state, including loaded code, compiled functions, and data, into an executable core file. This feature is crucial for creating standalone Lisp applications or quickly restarting complex Lisp environments without reloading all components from scratch, significantly reducing startup time for large systems.
HISTORY
SBCL originated in 1999 as a fork of CMUCL (Carnegie Mellon University Common Lisp), which was developed at CMU in the late 1980s. The primary motivation for the fork was to establish a stable, high-performance, and strictly ANSI Common Lisp compliant implementation, diverging from CMUCL's more experimental nature. Over the years, SBCL has become one of the most widely used and respected Common Lisp implementations, recognized for its robust native code compiler, multi-threading capabilities, and strong adherence to the Common Lisp standard. It continues to be actively developed and maintained by a dedicated community of volunteers.
SEE ALSO
emacs(1), lisp(1), ccl(1), ecl(1), gcl(1)