Installing Inko 0.11 On Macos
UPDATE: I’ve updated the Inko Formula on Homebrew
to 0.11.0, so you may just want to use brew install inko
instead. That said, There are a few bugfixes
on Inko that didn’t make it to the 0.11.0 release, so you may want to build off the main
branch instead.
I have a blog article in progress about why I’m super excited about the Inko Programming Language. It’s nowhere near completion, however, and I wanted to share how I got the latest version Inko running on MacOS (Ventura).
Inko recently released version 0.11, with many new features. Most notably, it is now ahead-of-time compiled to machine code instead of requiring a bytecode virtual machine (like Python and Java).
I had a bit of struggle getting the compiler and dependencies working locally, so I wanted to document the process.
Inko provides a version manager called ivm. ivm depends on Rust, and Inko itself depends on Rust and LLVM, specifically LLVM version 15:
brew install rust llvm@15
Rust ships with the cargo
package manager, and the inko version manager can be installed using cargo:
cargo install ivm
The homebrew-installed version of LLVM is not added to any paths by default because, to quote brew info llvm
,
“macOS already provides this software and installing another version in parallel can cause all kinds of trouble.”
So you’ll need to export a variable to tell ivm and Rust where llvm 15 is installed:
export LLVM_SYS_150_PREFIX=/usr/local/Cellar/llvm@15/15.0.7
(You may need to change the version number if brew installed something more recent)
Now you can run ivm. You might have ivm
on your PATH depending how cargo is configured, but I have that
disabled, so I had to add the path explicitly:
~/.cargo/bin/ivm install latest
If all goes well it should compile happily.
On MacOS, ivm installs inko to ~/Library/Application Support/ivm/installed/0.11.0/
❯ ~/Library/Application\ Support/ivm/installed/0.11.0/bin/inko --version
inko 0.11.0
❯
You can set the default inko version with:
~/.cargo/bin/ivm default 0.11.0
This simply creates a symlink in ~/Library/Application Support/ivm/bin
, so you either need to add that
directory to your path or do as I did and symlink the inko binary from a directory that is on your path,
as I did:
ln -s ~/Library/Application\ Support/ivm/bin/inko ~/.local/bin
(I don’t like my PATH variable getting too cluttered so I tend to manage it using symlinks instead)
Hello World
To test, create a file named hello.inko
with the following contents:
import std::stdio::STDOUT
class async Main {
fn async main() {
STDOUT.new.print("Hello, World")
}
}
run inko run hello.inko
to see it in action, or inko build hello.inko
to create a binary
in the build/debug
directory.
I’m really excited about this little-known programming language, and in an upcoming article, I’ll go into more detail as to why.