Learn run in 11 steps: from --version to WASI
A short, eleven-step tour of
run(therun-kitCLI). Each step is small on purpose: read it, type the line, watch what happens, move on.
If you want the full reference and deeper Rust integration story, the existing tutorial is here: run: Universal Multi-Language Runner & Persistent REPL.
01. What is run?
Normally, to run Python you type python3 script.py. For Go: go run main.go. For Rust: cargo run. Every language has a different command, different flags, different quirks.
run fixes that. One command, run, works for 25+ languages with the same syntax every time.
It has two modes:
- One-shot mode. Run a file or inline snippet and get the output immediately. Done.
- REPL mode. An interactive session where you type code line by line and see results instantly, like a conversation with the language.
Languages you can use right now: Python, JavaScript, Rust, Go, TypeScript, C / C++, Java, Ruby, Swift, Kotlin, and 15 more.
02. Verifying your install
You already installed run. Let’s confirm it works before anything else.
Open your terminal and type:
run --version
You should see something like:
run 1.x.x
Now get a quick overview of what it can do:
run --help
If you get “command not found”
The binary is always calledrun.run-kitis only the package name (Cargo crate / Homebrew formula). If your shell can’t findrun, the install location isn’t on yourPATH. Quick checks:
which runshould print a path like/usr/local/bin/runor~/.cargo/bin/run.- Cargo installs go to
~/.cargo/bin. Add it toPATHif missing:export PATH="$HOME/.cargo/bin:$PATH".- Homebrew (Apple Silicon) installs to
/opt/homebrew/bin; confirm withbrew list run-kitand thenbrew --prefix run-kit.- Open a new terminal after editing your shell profile.
03. Inline snippets
The fastest way to run code: write it directly in the command, no file needed.
The pattern:
run --lang <language> --code "your code here"
Try Python, the classic first step:
run --lang python --code "print('hello from run!')"
Expected output:
hello from run!
Now try JavaScript, same pattern, different language:
run --lang js --code "console.log('hello from js!')"
Expected output:
hello from js!
Language shortcuts.
--lang python=--lang py.--lang javascript=--lang js.--lang typescript=--lang ts. All aliases work; see step 8 for the full list.
04. Running files
Most of the time you’ll have code in a file. run handles that too, and can detect the language automatically.
Create a file to practice with:
echo 'print("I am running a file!")' > hello.py
Now run it. Just pass the file path:
run hello.py
Expected output:
I am running a file!
Auto language detection.
runsaw the.pyextension and knew it was Python. You didn’t have to specify--langat all. The same works for.js,.rs,.go,.ts, and every other supported extension.
You can also force a specific language even if the extension is different:
run --lang python hello.py
05. Piping data in
One of the most powerful features: feeding data into your code through stdin using the Unix pipe (|) operator.
What is piping?
The|symbol connects two commands: the output of the first becomes the input of the second.runcan read that input in your code using standard stdin.
Pipe text into Python and process it:
echo "hello world" | run python --code "import sys; print(sys.stdin.read().strip().upper())"
Expected output:
HELLO WORLD
Pipe JSON into JavaScript:
echo '{"name":"Esube"}' | run js --code "const d = JSON.parse(require('fs').readFileSync(0,'utf8')); console.log('Hi ' + d.name)"
Expected output:
Hi Esube
Real-world use. This is the building block for ETL scripts, log processing, and data transformation: pipe a CSV in, process it in Python, pipe the result to the next tool.
runslots cleanly into Unix pipelines.
06. Interactive REPL mode
The REPL (Read, Eval, Print Loop) is where run really shines for exploration and learning. It’s a live conversation with any language.
Launch the REPL with no arguments:
run
Here’s what a session looks like:
Welcome to Run REPL · type :help for commands
Active language: python
py › x = 42
py › print(x * 2)
84
py › :lang js
Switched to javascript
js › let arr = [1,2,3]; arr.map(n => n * 2)
[ 2, 4, 6 ]
js › :exit
State persists within a session. Variables you define stay alive.
x = 42on line 1 is still accessible on line 10. Use:reset(next step) to clear everything and start fresh without leaving the REPL.
07. REPL commands (meta commands)
Inside the REPL, special commands starting with : control the session, not code, just navigation.
| Command | What it does |
|---|---|
:help |
Show all available commands |
:languages |
List every supported language and its aliases |
:versions |
Show toolchain versions currently installed on your system |
:lang <name> |
Switch the active language, e.g. :lang go, or the short alias :go, :py, :rs |
:detect on / off |
Toggle auto-detection of language from what you type |
:load <file> |
Run a file inside the current session; its state merges with yours |
:reset |
Wipe the session state. Start fresh without leaving the REPL |
:exit / :quit |
Leave the REPL and return to your normal terminal |
Try switching languages in a single session:
py › :lang rust
Switched to rust
rs › println!("hello from Rust REPL!");
hello from Rust REPL!
rs › :languages
python, javascript, typescript, rust, go, c, cpp ...
About
:detect. Read this before you get stuck.
Auto-detect inspects what you type and can sometimes pick the wrong language. For example, typingprint(x * 2)while a Python session is active can be classified as Lua, which then errors with something like this:
text [auto-detect] switching python -> lua Error: lua failed session.lua:2: attempt to perform arithmetic on a nil value (global 'x')If that happens, you have three easy fixes:
- Run
:detect offto stop auto-switching for the rest of the session.- Run
:lang python(or:py) to force the language back.- Start future sessions with auto-detect off by exporting
RUN_DETECT=offin your shell (see step 9).Auto-detect is convenient when you genuinely jump between languages; turn it off when you’re focused on one.
08. Switching languages: all the aliases
Every language has a short alias so you type less. Here are the ones you’ll use most.
| Language | Aliases |
|---|---|
| Python | py, python |
| JavaScript | js, node |
| TypeScript | ts, deno |
| Rust | rs, rust |
| Go | go |
| C | c |
| C++ | cpp, cxx |
| Java | java |
| C# | cs, csharp |
| Ruby | rb, ruby |
| Swift | swift |
| Kotlin | kt, kotlin |
| Bash | bash |
| PHP | php |
| Lua | lua |
| R | r |
| Haskell | hs |
| Elixir | ex |
| Julia | jl |
| Dart | dart |
REPL shortcut. Inside the REPL you can switch language with just
:py,:go,:rs. No need to type:langfirst.
09. Configuration
Set up shortcuts and permanent settings so run behaves the way you like.
Aliases. run lets you give a language or a common command pattern a shorter name, for example mapping a single letter to your default language. There’s a personal alias list you can view and edit later from the CLI; you don’t need to memorise the exact subcommands now. When you’re ready, run --help will surface the alias commands available in your installed version.
Environment variables. Set these in your shell profile (~/.zshrc on macOS) for permanent config:
# Set your default language for the REPL
export RUN_DEFAULT_LANG=python
# Disable auto-detection by default (recommended if you mostly stay in one language)
export RUN_DETECT=off
RUN_DETECT=off is the permanent version of :detect off from step 7. Useful if you found auto-detect mis-classifying lines in your sessions.
Configuration file.
runalso reads from a config file at~/.config/run/config.toml. Checkrun config --helpto see all options.
10. Run 2.0: WASI components
The experimental frontier: compile your code to WebAssembly and run it anywhere, or compose code across languages.
What is WASI 0.2?
WebAssembly System Interface, a standard that lets you compile your code into a portable.wasmcomponent. That component runs anywhere (cloud edge, browser, another machine) without recompiling.run2.0 adds this on top of the regular REPL/runner.
Install with WASI v2 support:
cargo install run-kit --features v2
See what v2 can do:
run v2 --help
Experimental. Run 2.0 / WASI features are still in preview. Use the stable
runcommands for day-to-day work; tryv2when you want to explore edge deployment or cross-language composition.
11. Putting it all together
A quick-reference cheatsheet for everything you’ve learned. Bookmark this.
| Task | Command |
|---|---|
| Check version | run --version |
| Inline Python | run --lang python --code "print('hi')" |
| Inline JS (alias) | run --lang js --code "console.log(1+1)" |
| Run a file | run hello.py |
| Run + force language | run --lang go main.go |
| Pipe data in | echo "text" \| run py --code "import sys; print(sys.stdin.read())" |
| Open the REPL | run |
| Switch language in REPL | :lang rust (or just :rs) |
| Load file in REPL | :load script.py |
| Reset REPL state | :reset |
| List languages | :languages |
| Exit REPL | :exit |
| Turn off auto-detect | :detect off (one session) or export RUN_DETECT=off (permanent) |
| Install v2 (WASI) | cargo install run-kit --features v2 |
Want to go deeper? Try the full docs at run.esubalew.dev, or read the longer post: run: Universal Multi-Language Runner & Persistent REPL.
That’s the full hands-on classroom: eleven lessons covering the features of run-kit you’ll reach for first. If something here saved you time, drop a star on github.com/Esubaalew/run.