Skip to content

Instantly share code, notes, and snippets.

Last active November 2, 2019 08:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save cellularmitosis/afb56075ee5d53275c40769fa433cc85 to your computer and use it in GitHub Desktop.
Installing Elk Scheme on Mac OSX Mojave

Blog 2019/9/9

<- previous | index | next ->

Installing Elk Scheme on Mac OSX Mojave

Elk has a very fast start-up time, even on old hardware.

Attached is the install script I came up with.

Try it out:

$ echo '(display "Hello, world!\n")' > /tmp/hello.scm
$ elk -l /tmp/hello.scm
Hello, world!

I've also attached a Dockerfile. Try it out:

$ docker build -t elk .
$ docker run -it --rm elk
> (display "Hello, world!")
Hello, world!

Don't forget to alias elk="rlwrap elk".

FROM debian:buster
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get -y install wget build-essential file libgdbm-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* && \
cd /tmp && \
wget -O - | gunzip | tar x && \
cd elk-3.99.8 && \
./configure && \
make && \
make install && \
ldconfig && \
cd .. && \
rm -rf /tmp/elk-3.99.8
CMD ["elk"]
# install the elk scheme in mac osx mojave.
# see
set -e -o pipefail
if [ ! -e /usr/local/include/libelf ]
if [ ! -e /usr/local/include/elf.h ]
wget -O /usr/local/include/elf.h
if [ ! -e /usr/local/include/elftypes.h ]
wget -O /usr/local/include/elftypes.h
brew install libelf
if [ ! -e ~/Downloads/elk-${VERSION}.tar.gz ]
mkdir -p ~/Downloads
cd ~/Downloads
# Note: the 'cctools' homebrew package may install a version of 'ar' and 'ranlib' which can cause the build to fail:
# /opt/local/bin/ranlib: object: .libs/libelk.a(libelk_la-autoload.o) malformed object (unknown load command 1)
# ar: internal ranlib command failed
# make[2]: *** [] Error 1
# To work-around this, we temporarily put /usr/bin at the front of $PATH.
if [ "`which ranlib`" != "/usr/bin/ranlib" ]
export PATH="/usr/bin:${PATH}"
cd /tmp
rm -rf elk-${VERSION}
cat ~/Downloads/elk-${VERSION}.tar.gz | gunzip | tar x
cd elk-${VERSION}
./configure CFLAGS='-I/usr/local/include/libelf' --prefix=/opt/elk-${VERSION}
# note: 'make -j 4' fails, while 'make' does not.
sudo make install
ln -sf /opt/elk-${VERSION}/bin/elk /usr/local/bin/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment