# Tutorial: your first MoonBit program in Turbo MoonBit By the end of this tutorial you will have written, formatted, run and broken a small MoonBit program without leaving the editor — and seen the editor tell you where the mistake was. No prior knowledge of Turbo MoonBit is needed. You need Go 1.26 or later to build the editor, and the MoonBit toolchain to build the program. ## Prerequisites Check Go: ```bash go version ``` You should see something like: ``` go version go1.26.5 linux/arm64 ``` Check the MoonBit toolchain: ```bash moon version --all ``` You should see three lines, each ending in a path: ``` moon 0.1.20260904 (94521db 2026-09-04) ~/.moon/bin/moon moonc v0.10.12+1634b282e (2026-09-07) ~/.moon/bin/moonc moonrun 0.1.20260904 (94521db 2026-09-04) ~/.moon/bin/moonrun ``` If that command is not found, install the toolchain first — [one command does it](../how-to/install-the-moonbit-toolchain.md). ## Step 1 — Install the editor ```bash git clone https://rickub.com/turbo-editors/turbo-moonbit.git cd turbo-moonbit make install ``` The installer builds, installs, and then checks what it installed. The last lines are: ``` ==> Checking the language server ✓ moon-lsp at ~/.moon/bin/moon-lsp ==> Ready ``` We now have a `turbo-moonbit` command. ## Step 2 — Make a project ```bash cd /tmp moon new hello cd hello ``` ``` Created username/hello at hello ``` `moon new` writes a `moon.mod`, a `moon.pkg`, a library file, some test files, and a `cmd/main/main.mbt` with a hello-world in it. **`moon.mod` is what Turbo MoonBit looks for** to find the root of a project, and it is the directory `moon-lsp` will be started in. ## Step 3 — Open the file ```bash turbo-moonbit cmd/main/main.mbt ``` The screen fills. Along the top: ``` File Edit Search Run Code Options Window Snippets MoonBit Help ``` Ten menus, and the ninth is named after the language. Along the bottom, at the right-hand end, you should see: ``` 1:1 LSP: ready ``` `LSP: ready` means `moon-lsp` started in this directory. We will use it in Step 8. ## Step 4 — Write the program Select everything with `Ctrl-A` and press `Delete`, then type this in. Type it exactly; we will look at the colours next. ```moonbit ///| struct Greeting { name : String times : Int } ///| fn greet(g : Greeting) -> Unit { for i in 0..