Getting Started
Install Hew and write your first program.
Install the compiler
Run the installer for your operating system:
v0.11.0 ยท Release
curl -fsSL https://hew.sh/install | bash -s -- --version 0.11.0curl -fsSL https://hew.sh/install | bash -s -- --version 0.11.0Invoke-WebRequest https://hew.sh/install.ps1 -OutFile install.ps1
.\install.ps1 -Version 0.11.0The 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.
export PATH="$HOME/.hew/bin:$PATH"Open a new terminal after installation so it picks up the updated PATH.
These commands select the compiler version used by the lessons. Run hew version to check your installation.
hew versionHello World
Create a file called 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:
sudo apt install gcc libc6-devsudo dnf install gcc glibc-develsudo pacman -S gcc glibcInstall the Xcode Command Line Tools if they are not already installed:
xcode-select --installInstall the LLVM 22 command-line tools with clang.exe and lld-link.exe on PATH, plus Visual Studio C++ Build Tools and the Windows SDK.
hew check hello.hew
hew build hello.hew -o hello
./helloHello, world!hew check hello.hew
hew build hello.hew -o hello.exe
.\hello.exeHello, 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:
code --install-extension hew-lang.hew-langOpen 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.
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.
curl -fsSLo hew-install.sh https://hew.sh/install
less hew-install.sh
bash hew-install.sh --version 0.11.0Invoke-WebRequest https://hew.sh/install.ps1 -OutFile install.ps1
Get-Content .\install.ps1
.\install.ps1 -Version 0.11.0Download the release shown above and verify its platform archive against the matching SHA-256 checksum file.
tag=v0.11.0
asset=hew-v0.11.0-darwin-aarch64.tar.gz # choose the asset for your Mac
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" | shasum -a 256 -c -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 -$tag = "v0.11.0"
$asset = "hew-v0.11.0-windows-x86_64.zip"
$base = "https://github.com/hew-lang/hew/releases/download/$tag"
Invoke-WebRequest "$base/$asset" -OutFile $asset
Invoke-WebRequest "$base/hew-$tag-checksums.txt" -OutFile checksums.txt
$expected = (Select-String -Path checksums.txt -Pattern " $asset$").Line.Split(" ")[0]
$actual = (Get-FileHash -Algorithm SHA256 $asset).Hash.ToLower()
if ($actual -ne $expected) { throw "checksum mismatch" }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 from source on macOS requires LLVM 22 and a Rust toolchain. Install LLVM via Homebrew:
brew install llvm cmake ninjaBuilding the Hew compiler from source requires LLVM 22 and a Rust toolchain. On Ubuntu/Debian:
# 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-buildBuilding from source on Windows requires a Rust toolchain, VS Build Tools 2022 (Desktop development with C++ workload), cmake, Ninja, and LLVM 22 from llvm.org.
Building from source
Clone the repository and build the compiler:
git clone --branch v0.11.0 https://github.com/hew-lang/hew.git
cd hew
make hew-nativeThe compiler driver is at target/debug/hew. Add it to your PATH:
export PATH="$PWD/target/debug:$PATH"The compiler driver is at target\debug\hew.exe. Add it to your PATH in PowerShell:
$env:PATH = "$PWD\target\debug;$env:PATH"