Skip to main content

Getting Started

Install Hew and write your first program.

Install the compiler

Run the installer for your operating system:

v0.11.0 ยท Release

Terminal
curl -fsSL https://hew.sh/install | bash -s -- --version 0.11.0

The installer adds hew, which includes the compiler and package manager.

Add the default installation to PATH in this terminal. For future terminals, run the permanent setup commands printed by the installer for your shell. If you chose a different prefix, use its printed PATH command.

Terminal
export PATH="$HOME/.hew/bin:$PATH"

These commands select the compiler version used by the lessons. Run hew version to check your installation.

Terminal
hew version

Hello World

Create a file called hello.hew:

hello.hew
fn main() {
    println("Hello, world!");
}

Compiling and running

Compile with hew build and run the resulting binary:

Native builds need a system C toolchain. If checking succeeds but linking fails, see the build troubleshooting guide (English).

The Linux SDK requires glibc. For the installer or a downloaded archive on Linux, install a C toolchain and system headers. For example:

Debian / Ubuntu
sudo apt install gcc libc6-dev
Fedora / RHEL
sudo dnf install gcc glibc-devel
Arch Linux
sudo pacman -S gcc glibc
Terminal
hew check hello.hew
hew build hello.hew -o hello
./hello
Output
Hello, world!

The hew build command runs the Rust frontend, lowers the checked program through HIR and MIR, and emits a native binary through LLVM.

Set up your editor

In VS Code, install Hew Language (hew-lang.hew-lang) from Extensions. If the code command is on PATH, you can also run:

Terminal
code --install-extension hew-lang.hew-lang

Open hello.hew. The language mode should be Hew, with syntax highlighting and diagnostics from the language server. The published extension includes hew-lsp for supported platforms.

To use a particular installed toolchain, set hew.lsp.serverPath and hew.formatterPath in VS Code settings to the full paths of hew-lsp and hew. Use absolute paths, without ~ or variables. Restart VS Code after changing PATH.

Vim, Neovim, Emacs and other editors (English)

Continue with the language tour

The tour adds functions, records, pattern matching, actor calls, and concurrent operations in short examples.

Open the language tour โ†’

Quick-reference chart

The printable two-sided chart covers everyday syntax, actors, concurrency, wire types, and machines.

Download PDF

Hew Playground on mobile

The illustrated iPhone/iPad guide and Android beta guide show how to open examples, edit, run and save code in the Hew Playground apps.

Other installation methods

To inspect the installer before running it, download it to a local file and read it first.

Terminal
curl -fsSLo hew-install.sh https://hew.sh/install
less hew-install.sh
bash hew-install.sh --version 0.11.0

Download the release shown above and verify its platform archive against the matching SHA-256 checksum file.

Terminal
tag=v0.11.0
asset=hew-v0.11.0-linux-x86_64.tar.gz # choose the asset for your Linux host
base="https://github.com/hew-lang/hew/releases/download/$tag"
curl -fLO "$base/$asset"
curl -fLO "$base/hew-$tag-checksums.txt"
grep "  $asset$" "hew-$tag-checksums.txt" | sha256sum -c -

You can also build the tagged release from source with the compiler prerequisites below.

Prerequisites for building from source

Source builds also require GNU Make and Python 3.12 or later. See the full build requirements (English).

Building the Hew compiler from source requires LLVM 22 and a Rust toolchain. On Ubuntu/Debian:

Terminal
# Install LLVM 22 (required by Inkwell)
wget https://apt.llvm.org/llvm.sh && chmod +x llvm.sh && sudo ./llvm.sh 22

# Install build tools
sudo apt install cmake ninja-build

Building from source

Clone the repository and build the compiler:

Terminal
git clone --branch v0.11.0 https://github.com/hew-lang/hew.git
cd hew
make hew-native

The compiler driver is at target/debug/hew. Add it to your PATH:

Terminal
export PATH="$PWD/target/debug:$PATH"