Getting Grain

GitHub   Edit on GitHub

We have a couple different ways to get Grain. Most developers will prefer the Packaged Grain binaries, but make sure to read the note about speed!

Packaged Grain

The Grain toolchain (including our CLI, compiler, runtime, and standard library) is shipped as a single binary. Binaries are available for MacOS x64, Linux x64, and Windows x64.

Note: These binaries are a bit slow when first building a project (around 70 seconds). The packaged compiler is running in JavaScript, and it builds and writes the runtime & standard library into your project. If you need raw speed, you can build the native compiler from source! See Building Grain from Source below.

MacOS x64 - Homebrew

The easiest way to install on MacOS is to install from our cask using homebrew.

brew install --no-quarantine --cask grain-lang/tap/grain

The --no-quarantine flag will avoid having to approve the binary in the Security Center.

MacOS x64 - Download

If you’d prefer not to use homebrew, you can download it directly from GitHub or using curl.

sudo curl -L --output /usr/local/bin/grain \ \
&& sudo chmod +x /usr/local/bin/grain

Linux x64 - Download

You can download it directly from GitHub or using curl.

sudo curl -L --output /usr/local/bin/grain \ \
&& sudo chmod +x /usr/local/bin/grain

Windows x64 - Download

You can download it directly from GitHub or using curl.

curl -LO

You’ll either want to put it into your path or keep it inside your project and invoke with .\grain-win-x64.exe.


These installation methods are maintained by the community—they’re not supplied by the Grain team, but you may find them to be useful alternatives to the official distributions.

Using asdf

You can install specific version of Grain toolchain using asdf runtime version manager.

asdf plugin add grain

# List all available version
asdf list all grain

asdf install grain 0.4.6
asdf global grain 0.4.6

See the plugin for more details.

Building Grain from Source

To get access to the entirely native compiler, you can build Grain from source.

First, you’ll need Node.js v16.

Start by cloning the Grain repository:

git clone
cd grain

To get everything set up, run:

npm ci
npm run compiler build

Running npm ci will fetch our dependencies and then set up the Grain runtime, standard library, and CLI. To rebuild any of those without checking dependencies, you can run npm run prepare separately.

Running npm run compiler build will compile the compiler (it’s pretty meta—we know).

After running these commands, you’ll have a new command available on your command line—grain. The grain command is a CLI tool that both compiles and runs Grain programs.

You can check that everything is installed properly by running the version command:

grain --version

If you see a a version for the CLI and the compiler, you’re all set! If not, please consult the Troubleshooting section.

We’ll first use the grain CLI to compile and run a Hello World program, but first let’s set up our editor.


This section contains solutions to problems which people may run into when building and installing Grain.

After install, the grain command is not found

This likely means that you haven’t put npm‘s global bin directory on your shell’s PATH variable. This can be fixed by setting the variable in your shell’s configuration. For example, if you use zsh, you can do the following:

# Initialize the PATH variable in your configuration and enable the change
(echo 'export PATH="${PATH}:$(npm bin --global)"' >> ~/.zshrc) && source ~/.zshrc

For bash, the process is the same, except ~/.zshrc should be replaced with ~/.bashrc.

For Windows cmd.exe and PowerShell users, you can run the following inside of PowerShell to update the PATH for your current user (this will fix the PATH variable for both cmd.exe and PowerShell):

[Environment]::SetEnvironmentVariable("Path", $env:Path + ";" + (npm bin --global) -join "`n","User")

If you would like to update the PATH for all users, replace "User" with "Machine". After running this command, restarting the shell should fix the issue.

For other shells, the process may look a little different, but the procedure should always look something like the following:

  • Determine the output of npm bin --global
  • Put the directory that this command outputs onto your PATH variable
  • Restart or reinitialize your shell as needed to make the change take effect

If the grain command still does not work, then please contact us in the #support channel on our Discord.

This is a notification!