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?
- Install Roswell
- 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
- 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.
- Configure clpm to work with SBCL and Roswell
- If you’re comfortable running scripts off of the internet, you can run
/bin/bash -c "$(curl -fsSL https://smashedtoatoms.com/rando/configure-clpm-to-work-with-sbcl-via-roswell.sh)"
- If you’re not, follow these
instructions with the following
- In the step where the clpm docs have you update your lisp’s init file,
instead of updating
~/.sbclrclike they suggest, update
~/.roswell/init.lisp. For example:
clpm client rc > ~/.roswell/init.lisp
- 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
- Set up clpm config to use the afore configured bash script as the sbcl
echo $'(version "0.2")\n\n((:grovel :lisp)\n :implementation :sbcl\n :path "/usr/local/bin/sbcl")' > $HOME/.config/clpm/
- In the step where the clpm docs have you update your lisp’s init file, instead of updating
- If you’re comfortable running scripts off of the internet, you can run this:
- Get to work
- 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)"
- If that works, you’re good to go! Go check this out to see how you can use this setup with vscode.
- I typically build lake to validate that my setup is working. Clone it, cd into the directory, and run this:
Do you have an example of doing this on something like the M1 mac?
- Install brew:
- Install OpenSSL via brew. This is important to prevent the “loading
libcrypto in an unsafe way” bullshit
brew install openssl
- Install Roswell
brew install --build-from-source roswell"
- Init Roswell (you can install whatever lisp you want, I recommend SBCL)
ros install sbcl 2.1.2
- 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.