Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis
Last active November 2, 2019 08:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cellularmitosis/afb56075ee5d53275c40769fa433cc85 to your computer and use it in GitHub Desktop.
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 - http://sam.zoy.org/elk/elk-3.99.8.tar.gz | gunzip | tar x && \
cd elk-3.99.8 && \
./configure && \
make && \
make install && \
ldconfig && \
cd .. && \
rm -rf /tmp/elk-3.99.8
CMD ["elk"]
#!/bin/bash
# install the elk scheme in mac osx mojave.
# see http://sam.zoy.org/elk/
set -e -o pipefail
VERSION=3.99.8
if [ ! -e /usr/local/include/libelf ]
then
if [ ! -e /usr/local/include/elf.h ]
then
wget -O /usr/local/include/elf.h https://opensource.apple.com/source/dtrace/dtrace-96/sys/elf.h
fi
if [ ! -e /usr/local/include/elftypes.h ]
then
wget -O /usr/local/include/elftypes.h https://opensource.apple.com/source/dtrace/dtrace-96/sys/elftypes.h
fi
brew install libelf
fi
if [ ! -e ~/Downloads/elk-${VERSION}.tar.gz ]
then
mkdir -p ~/Downloads
cd ~/Downloads
wget http://sam.zoy.org/elk/elk-3.99.8.tar.gz
fi
# 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]: *** [libelk.la] Error 1
# To work-around this, we temporarily put /usr/bin at the front of $PATH.
if [ "`which ranlib`" != "/usr/bin/ranlib" ]
then
export PATH="/usr/bin:${PATH}"
fi
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.
make
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