Most recent Lisp implementations include a copy of ASDF 2, and soon ASDF 3.
You can usually load this copy using Common Lisp's
As of the writing of this manual, the following implementations provide ASDF 2 this way: abcl allegro ccl clisp cmucl ecl lispworks mkcl sbcl xcl. The following implementation doesn't provide it yet but will in an upcoming release: scl. The following implementations are obsolete, not actively maintained, and most probably will never bundle it: cormanlisp gcl genera mcl.
If the implementation you are using doesn't provide ASDF 2 or ASDF 3, see see Loading an otherwise installed ASDF below. If that implementation is still actively maintained, you may also send a bug report to your Lisp vendor and complain about their failing to provide ASDF.
NB: all implementations except clisp also accept
(require 'asdf) and
For portability's sake, you probably want to use
To check whether ASDF is properly loaded in your current Lisp image, you can run this form:
If it returns a string, that is the version of ASDF that is currently installed.
If it raises an error, then either ASDF is not loaded, or you are using an old version of ASDF.
You can check whether an old version is loaded by checking if the ASDF package is present. The form below will allow you to programmatically determine whether a recent version is loaded, an old version is loaded, or none at all:
(when (find-package :asdf) (let ((ver (symbol-value (or (find-symbol (string :*asdf-version*) :asdf) (find-symbol (string :*asdf-revision*) :asdf))))) (etypecase ver (string ver) (cons (with-output-to-string (s) (loop for (n . m) on ver do (princ n s) (when m (princ "." s))))) (null "1.0"))))
If it returns
nil then ASDF is not installed.
Otherwise it should return a string.
If it returns
"1.0", then it can actually be
any version before 1.77 or so, or some buggy variant of 1.x.
If you are experiencing problems with ASDF, please try upgrading to the latest released version, using the method below, before you contact us and raise an issue.
If your implementation provides ASDF 3 or later,
you only need to
ASDF will automatically look whether an updated version of itself is available
amongst the regularly configured systems, before it compiles anything else.
See see Configuring ASDF below.
If your implementation does provide ASDF 2 or later, but not ASDF 3 or later, and you want to upgrade to a more recent version, you need to install and configure your ASDF as above, and additionally, you need to explicitly tell ASDF to load itself, right after you require your implementation's old ASDF 2:
(require "asdf") (asdf:load-system :asdf)
If on the other hand, your implementation only provides an old ASDF,
you will require a special configuration step and an old-style loading.
Take special attention to not omit the trailing directory separator
/ at the end of your pathname:
(require "asdf") (push #p"/path/to/new/asdf/" asdf:*central-registry*) (asdf:oos 'asdf:load-op :asdf)
Note that ASDF 1 won't redirect its output files, or at least won't do it according to your usual ASDF 2 configuration. You therefore need write access on the directory where you install the new ASDF, and make sure you're not using it for multiple mutually incompatible implementations. At worst, you may have to have multiple copies of the new ASDF, e.g. one per implementation installation, to avoid clashes. Note that to our knowledge all implementations that provide ASDF provide ASDF 2 in their latest release, so you may want to upgrade your implementation rather than go through that hoop.
Finally, if you are using an unmaintained implementation that does not provide ASDF at all, see see Loading an otherwise installed ASDF below.
Note that there are some limitations to upgrading ASDF:
:depends-on (:asdf), or
:depends-on ((:version :asdf "2.010")), but instead that they check that a recent enough ASDF is installed, with such code as:
(unless (or #+asdf2 (asdf:version-satisfies (asdf:asdf-version) *required-asdf-version*)) (error "FOO requires ASDF ~A or later." *required-asdf-version*))
If your implementation doesn't include ASDF, if for some reason the upgrade somehow fails, does not or cannot apply to your case, you will have to install the file asdf.lisp somewhere and load it with:
The single file asdf.lisp is all you normally need to use ASDF.
You can extract this file from latest release tarball on the ASDF website. If you are daring and willing to report bugs, you can get the latest and greatest version of ASDF from its git repository. See Getting the latest version.
For maximum convenience you might want to have ASDF loaded whenever you start your Lisp implementation, for example by loading it from the startup script or dumping a custom core — check your Lisp implementation's manual for details.