Loading
...
c-runner logo

c-runner

The fastest way to compile and run C code โ€” single files or full projects, with live watch mode.

v2.0.0ยท
Visitors:
bash
$ c-runner main.c -i input.txt -o output.txt --watch
๐Ÿ”จ Compiling main.c...
โœ… Compiled in 38ms
โ–ถ๏ธ Running...
---
$ โ–ˆ
scroll
Features

Everything you need

No config required to get started.

01

Smart Compilation

Direct compilation for single files, cached incremental builds for projects โ€” only recompiles what changed.

02

Watch Mode

Auto-recompile on file changes using inotifywait, fswatch, entr, or built-in polling as fallback.

03

File I/O Mode

Pipe input.txt into stdin and capture program output to output.txt โ€” perfect for testing scanf-based programs.

04

Auto Starter

Missing or empty .c file? c-runner creates it with Hello World starter code and runs it immediately.

05

Configurable

Use config.yml or environment variables to customize source, build directories, and file I/O per project.

06

Clean Execution

Single files compile to a temp binary, run, then clean up automatically โ€” zero leftover files.

Installation

Installation

Get up and running in under a minute.

1. Install dependencies
sudo apt update                                  # refresh package list
sudo apt install build-essential inotify-tools   # gcc + file watcher for watch mode
2. Download & install c-runner
wget https://c-runner.vercel.app/c-runner        # download the binary
chmod +x c-runner                                # make it executable
sudo mv c-runner /usr/local/bin/                 # install globally
c-runner --version                               # verify installation
Tutorial

Tutorial

See c-runner in action.

Usage

Usage

All available commands at a glance.

Version
c-runner --version

Display version and author information.

Help
c-runner --help

Show all available commands and options.

Initialize config
c-runner --init

Create a config.yml with default src_dir, build_dir, and file_mode settings.

Run project
c-runner run

Compile all .c files in the project and run the executable.

Watch project
c-runner run --watch

Auto-recompile the entire project on any file change.

Run a single file
c-runner main.c

Compile and run a .c file. Creates it with starter code if missing or empty.

Watch a single file
c-runner main.c --watch

Auto-recompile on every save. Creates starter code if file is missing or empty.

Stdin from file
c-runner main.c -i input.txt

Pipe input.txt into stdin โ€” each line feeds the next scanf call.

Capture output
c-runner main.c -o output.txt

Write program output to output.txt. Overwrites on every run.

Full file I/O + watch
c-runner main.c -i input.txt -o output.txt --watch

Watch mode with file I/O โ€” reruns on .c or input.txt changes.

Configuration

Configuration

Customize per project with a simple YAML file.

config.yml
# GCC Build Configuration
src_dir: src
build_dir: build

# File I/O mode (optional)
# file_mode:
#   input: input.txt        # pipe this file into stdin
#   output: output.txt      # write program output to this file
#   view_terminal: true     # also print output to terminal (default: false)
input.txt
# comment lines are ignored โ€” use them to document your inputs
10 20       # a and b

# next scanf value
300

How It Works

  • โ†’Single file โ€” compiles to a temp binary, runs, cleans up. Creates starter code if file is missing or empty.
  • โ†’Project mode โ€” compiles all .c files, outputs binary named after main.c into build_dir.
  • โ†’File I/O โ€” CLI flags -i / -o override config.yml values.
  • โ†’input.txt comments โ€” lines starting with # are stripped before being piped to stdin.

Config Keys

  • src_dirSource directory (default: .)
  • build_dirBuild directory (default: build)
  • inputStdin source file (default: โ€”)
  • outputStdout target file (default: โ€”)
  • view_terminalAlso print to terminal (default: false)
Uninstall

Uninstall

Remove c-runner
sudo rm /usr/local/bin/c-runner