Running Scala Native on Mac OS

Scala Native runs well on modern versions of Mac OS (10.12 or newer), and it only takes a few steps to install. If something goes wrong in the installation, however, it can be tricky to troubleshoot. But if all goes well, installing on Mac OS is probably the easiest way to get started with Scala Native.

First, you’ll need the same basic components as for any Scala project:

To install sbt, follow the instructions in the sbt release docs.[67] You can install any version; sbt can bootstrap an earlier or later version of itself as needed.

Once sbt is installed, you’ll need the following C/C++ dependencies for the Scala Native compiler and runtime, plus a few others we’ll use in the book:

These you can install with Homebrew,[68] the Mac OS package manager. Once brew is installed, run brew install llvm re2 libuv curl curl-openssl and you should be good to go. To test it out, try to set up and build the sample code in the Systems Programming in the Twenty-First Century. You can also download all of the code used in this book from the book’s web page at pragprog.com.[69]

While getting started with Scala Native might be easy to do on Mac OS, if things go wrong, it can be very tricky to debug. If you’d rather forgo the potential headaches, containers may be the way to go.