Installing SBCL via Roswell with CLPM in 2021

Why would I want to use SBCL via Roswell with CLPM?

I created an asdf installer for sbcl and paired it with CLPM. It is great. I love it for my projects. The problem is that large swaths of the Common Lisp world that I work in lean heavily on quicklisp and Roswell scripts. I prefer how CLPM works, so I am documenting how I use SBCL via Roswell with CLPM. This doesn’t always work. I get better behavior not using Roswell, but I’m putting this here in case you have no choice.

Cool, how do I do it?

  1. Install Roswell
  2. Install SBCL using Roswell (use 2.1.2 or greater if you’re on an M1 mac) and set it as the default.
    ros install sbcl 2.1.2
    ros use sbcl 2.1.2
  3. Install the clpm binary
    • Note: there isn’t a clpm binary for the M1 Mac yet. If you need one now, you can either build it yourself from the source, or use this one that I built if you trust me.
  4. Configure clpm to work with SBCL and Roswell
    1. If you’re comfortable running scripts off of the internet, you can run this:
      /bin/bash -c "$(curl -fsSL"
    2. If you’re not, follow these instructions with the following modifications.
      1. In the step where the clpm docs have you update your lisp’s init file, instead of updating ~/.sbclrc like they suggest, update ~/.roswell/init.lisp. For example:
        clpm client rc > ~/.roswell/init.lisp
      2. Create a bash script to use to launch roswell in a single command to work around CLPM 0.3 issues with Roswell subcommands.
        sudo echo $'#!/bin/sh\n\nexec ros run == "[email protected]"\n' > /usr/local/bin/sbcl && sudo chmod 755 /usr/local/bin/sbcl
      3. Set up clpm config to use the afore configured bash script as the sbcl executable.
        echo $'(version "0.2")\n\n((:grovel :lisp)\n  :implementation :sbcl\n  :path "/usr/local/bin/sbcl")' > $HOME/.config/clpm/
  5. Get to work
    1. I typically build lake to validate that my setup is working. Clone it, cd into the directory, and run this:
      clpm exec --context=lake -- sbcl \
        --eval '(setf clpm-client:*asdf-system-not-found-behavior* :install)' \
        --eval '(setf clpm-client:*context-diff-approval-method* t)' \
        --eval '(asdf:load-system :lake)' \
        --eval '(asdf:clear-system :clpm-client)' \
        --eval "(sb-ext:save-lisp-and-die \"lake\" :toplevel #'lake/main:uiop-main :executable t :compression 9)"
    2. If that works, you’re good to go! Go check this out to see how you can use this setup with vscode.

Do you have an example of doing this on something like the M1 mac?

  1. Install brew:
  2. Install OpenSSL via brew. This is important to prevent the “loading libcrypto in an unsafe way” bullshit
    brew install openssl
  3. Install Roswell
    brew install --build-from-source roswell"
  4. Init Roswell (you can install whatever lisp you want, I recommend SBCL)
    ros install sbcl 2.1.2
  5. Install CLPM and configure it to work with SBCL and Roswell just like step 3-4 of the first section.

If you have any trouble with any of this, feel free to reach out.