Skip to main content

Installation

Prerequisites

  • macOS 12+ (Monterey or later)
  • Xcode Command Line Tools: xcode-select --install
  • GCC or Clang

Building the SDK

1

Clone the repository

2

Initialize submodules

This step is required! The build will fail without submodules.
3

Build C SDK

4

Verify build


Simple API (Easiest)

1

Create a file hello.c

2

Build and run

What’s happening:
  1. BoxLite pulls the python:slim OCI image (first run only)
  2. Creates a lightweight VM with the image
  3. Executes the Python command inside the VM
  4. Buffers stdout/stderr and returns the result
  5. Automatically cleans up when boxlite_simple_free() is called

Native API (Full Control)

For advanced use cases with streaming output and custom configuration.
1

Create a file native.c

2

Build and run

Build and run using the same commands as the Simple API above.

Running Examples

BoxLite includes 8 comprehensive C examples:
Examples overview:

Error Handling

The C SDK uses structured error handling:
Error codes: See C SDK API Reference for the complete list.

Next Steps

Core concepts

Understand the different box types, lifecycle, images, and resource configuration.

C SDK Reference

Complete SDK documentation covering Simple API and Native API details, JSON configuration schema, Memory management rules, Threading and safety, and Troubleshooting guide.

C API Reference

Function signatures and parameters for the C SDK.

C Examples

Working code examples on GitHub.