Native Executable

This guide covers how you can can build and run a native executable.

Building a native executable

To start with, create a Viash component that targets the native platform as explained in this guide or download the sample component via the download button below.
The zip contains the component in all supported languages. Simply rename the language folder you want to use to hello_world and use that as your working directory.


Next, use the viash build command to generate an executable inside of a bin directory:

viash build config.vsh.yaml --output bin

This will generate an executable named the same as your component in the bin directory:

├── bin
│   └── hello_world
├── config.vsh.yaml


It’s often useful to know what arguments an executable expects before trying to run it. To display its documentation, run the executable with just the --help argument:

bin/hello_world --help

This will result in output that looks like this:


A minimal example component.

        type: string
        default: World

This example takes a single optional string named --input as an argument.

Running the executable

Running a native executable is the same as any other executable on your system. Simply call it as a command in your terminal:


This results in the following output:

Hello World

You can pass arguments to it directly, which differs from using the viash run command as Viash itself isn’t called:

bin/hello_world --input "everyone!"

This outputs:

Hello everyone!

What’s next?

Now you know how to build and run native executables, you might also be interested in learning more about executables with a Docker backend.