Skip to main content
tip

If you encounter any problems, please report them on Github or in our forum. Your feedback is greatly appreciated and helps us to improve!

MoonBit Language plugin in Visual Studio Code

You can install it from the VS Code marketplace. This plugin provides a rich development environment for MoonBit, including functionalities like syntax highlighting, code completion, and more.

Instructions

Step 1: Install the latest VS Code version.

Step 2: Click Extension on the left, search "MoonBit" and install VS Code MoonBit extension.

Untitled

Untitled

Step 3: Press the shift+cmd+p shortcut (for Mac, use ctrl+shift+p on Windows or Linux), and type MoonBit:install latest moonbit toolchain. Then a prompt will appear, click "Yes" and wait for the program to download.

Untitled

Step 4: After the download is complete, open the terminal and enter moon new hello && code hello to create and open a new project.

Step 5: Once the project is launched, open the terminal again and enter the moon run main command to start executing the code.

MoonBit CLI Tools

To download and install MoonBit, run the following in your terminal, then follow the on-screen instructions.

/bin/bash -c "$(curl -fsSL https://cli.moonbitlang.com/mac_m1_moon_setup.sh)"

This command line tool is needed for creating and managing MoonBit projects.

Use moon help to view the usage instructions.

$ moon help
Moonbit's build system

Usage: moon <COMMAND>

Commands:
build Build the current package
check Check the current package, but don't build object files
run Run WebAssembly module
clean Remove the target directory
new Create a new moonbit package
bench Generate build matrix for benchmarking
fmt Format moonbit
version Print version info and exit
test Run the tests
login Log in to your account
register Register an account on mooncakes.io
publish Publish the current package
add Add a new dependency
remove Remove a dependency
tree Display the dependency tree
update Update index
doc Generate documentation
install Install dependencies
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help