Install OSL
Install the compiler, check it works, and set up your editor. About two minutes.
OSL compiles your code to Go, and Go turns it into a native executable. So you need two things on the machine where you build: OSL and a recent Go toolchain (1.25 or newer). The programs you build need neither: they are single files that run on their own.
Install Go
Download it from go.dev/dl, or use your package manager:
brew install go # macOS sudo pacman -S go # Arch sudo apt install golang # Debian and UbuntuCheck it with
go version.Install OSL
One line installs both
osl, the compiler, andopal, the project and package manager:curl -fsSL https://gosl.mistium.com | shCheck it
osl version opal versionBoth print a version number. If your shell can't find them, open a new terminal so it picks up the updated
PATH.Run something
Make a file called
hello.osl:log "Hello from OSL"Click the code to edit itThen run it:
osl run hello.oslThe first build takes a few seconds while Go compiles OSL's runtime. After that, builds come from a cache and take a fraction of a second.
Set up your editor#
osl lsp is a language server: diagnostics as you type, completion, hover types, go to definition, rename, formatting and quick fixes. Any editor that speaks the Language Server Protocol can use it. Point the editor's LSP client at the command osl lsp for files ending in .osl.
For Neovim, for example:
vim.lsp.config("osl", {
cmd = { "osl", "lsp" },
filetypes = { "osl" },
root_markers = { "opal.json", ".git" },
})
vim.lsp.enable("osl")
vim.filetype.add({ extension = { osl = "osl" } })You can also check a whole project from the terminal, which is what the editor sees:
osl lsp check main.oslBuild from source#
The compiler is open source. To build the newest version yourself:
git clone https://git.rotur.dev/osl/.go osl
cd osl
go build -o osl .
./osl setup # installs it as the osl and opal commandsKeep it up to date#
osl updateosl uninstall removes it again.