sigildocs

Getting Started

Get Sigil running in under five minutes.

Try It in Your Browser

Want to experiment before installing? Try Sigil in your browser—no installation required.

Download

Download the latest release for your platform from Codeberg releases:

# Download the latest Linux release
curl -LO https://codeberg.org/sigil/sigil/releases/download/latest/sigil-linux-amd64

# Make it executable
chmod +x sigil-linux-amd64

Try It Out

Before installing, you can experiment with the downloaded binary directly:

# Start the REPL
./sigil-linux-amd64 repl

# Evaluate an expression
./sigil-linux-amd64 eval '(+ 1 2 3)'

# Run a file
./sigil-linux-amd64 eval -f hello.sgl

In the REPL, try some expressions:

> (+ 1 2 3)
6
> (define (square x) (* x x))
> (map square '(1 2 3 4 5))
(1 4 9 16 25)
> (import (sigil json))
> (json->string '((name . "Alice") (age . 30)))
"{\"name\":\"Alice\",\"age\":30}"

Press Ctrl+D or type in ,q to exit.

Install

Once you're ready to install Sigil permanently:

./sigil-linux-amd64 cli install

This creates ~/.sigil with the following structure:

~/.sigil/
├── bin/
│   └── sigil          # Version-switching wrapper script
├── versions/
│   └── 0.1.0/
│       └── sigil      # The actual binary
├── apps/              # Installed applications
├── cache/             # Downloaded files
└── current            # Currently active version

Add Sigil to your PATH by adding this to your shell config (~/.bashrc, ~/.zshrc, ~/.kshrc, or ~/.profile):

eval "$(~/.sigil/bin/sigil cli env)"

Or manually add the path:

export PATH="$HOME/.sigil/bin:$PATH"

Then restart your shell or source your config file.

You can now delete the downloaded binary - Sigil is installed at ~/.sigil/bin/sigil.

Upgrade

Check for and download new versions:

sigil cli upgrade

This downloads the latest release but doesn't activate it automatically. To switch:

sigil cli use 0.2.0

Other CLI Management Commands

sigil cli versions    # List installed versions
sigil cli use 0.1.0   # Switch to a specific version
sigil cli prune       # Remove old versions (keeps current)
sigil cli env         # Print shell configuration

See CLI Management for full documentation.

Your First Program

Create a file called hello.sgl:

;; hello.sgl - Your first Sigil program

(define (greet name)
  (println "Hello, ~a!" name))

(greet "World")
(greet "Sigil")

Run it:

sigil eval -f hello.sgl

Using Libraries

Sigil code is organized into libraries using a directory structure that matches the module name. Let's create a simple library.

First, create a lib/ directory and add lib/mylib.sgl:

;; lib/mylib.sgl
(define-library (mylib)
  (export greet say-goodbye)
  (begin
    (define (greet name)
      (string-append "Hello, " name "!"))

    (define (say-goodbye name)
      (string-append "Goodbye, " name "!"))))

Now create main.sgl in your project root:

;; main.sgl
(import (mylib))

(println "~a" (greet "Alice"))

Run it with the -L flag to add your library directory to the load path:

sigil eval -L lib -f main.sgl

For nested modules like (myproject utils), create lib/myproject/utils.sgl.

Standard Library

Sigil includes libraries for common tasks:

ModuleDescription
(sigil io)File I/O and ports
(sigil fs)Filesystem operations
(sigil path)Path manipulation
(sigil string)String utilities
(sigil json)JSON parsing and generation
(sigil process)Process spawning
(sigil socket)TCP/UDP networking
(sigil http)HTTP server
(sigil time)Date and time
(sigil test)Testing framework
(sigil channels)CSP-style channels
(sigil coroutines)Generators and coroutines

Building from Source

There are two ways to build Sigil from source:

Option 1: Using an existing Sigil installation

If you already have Sigil installed, you can build the latest version directly:

git clone https://codeberg.org/sigil/sigil.git
cd sigil
sigil build sigil-cli --config release
./build/release/bin/sigil cli install

Option 2: Bootstrap build

If you don't have Sigil installed, bootstrap from scratch:

git clone https://codeberg.org/sigil/sigil.git
cd sigil
make CC=gcc
./build/boot/bin/sigil build sigil-cli --config release
./build/release/bin/sigil cli install

The bootstrap build creates a minimal CLI at ./build/boot/bin/sigil, which is then used to build the release CLI.

For the smoothest experience, use GNU Guix:

guix shell -m manifest.scm
make CC=gcc
./build/boot/bin/sigil build sigil-cli --config release

Building on OpenBSD

OpenBSD is fully supported. Use gmake (GNU Make) instead of the default BSD make:

pkg_add gmake
git clone https://codeberg.org/sigil/sigil.git
cd sigil
gmake CC=cc
./build/boot/bin/sigil build sigil-cli --config release
./build/release/bin/sigil cli install

Next Steps

  • Tutorial - Build a complete application from scratch
  • Guides - Deep dives into specific features
  • Reference - Complete API documentation