Homebrew (macOS):
brew tap wess/goose
brew install gooseShell script:
curl -fsSL https://raw.githubusercontent.com/wess/goose/main/install.sh | shCustom install directory:
GOOSE_INSTALL_DIR=~/.local curl -fsSL https://raw.githubusercontent.com/wess/goose/main/install.sh | shasdf:
asdf plugin add goose https://github.com/wess/goose.git
asdf install goose latest
asdf global goose latestBuild from source:
git clone https://github.com/wess/goose.git
cd goose
make
make install # installs to /usr/localTo install to a custom location:
make install PREFIX=~/.localTo uninstall:
make uninstallgoose new hello
cd helloThis creates the following structure:
hello/
goose.yaml
src/
main.c
.gitignore
goose build # debug build -> build/debug/hello
goose build -r # release build -> build/release/hello
goose run # build + run (debug)
goose run -r # build + run (release)Every goose project has a goose.yaml at its root:
project:
name: "hello"
version: "0.1.0"
description: "My first goose project"
author: "Your Name"
license: "MIT"
build:
cc: "cc"
cflags: "-Wall -Wextra -std=c11"
includes:
- "src"
dependencies:Dependencies are git repositories or local paths:
goose add https://github.com/user/somelib.gitThis clones the repo into packages/somelib/, adds it to goose.yaml, and records the exact commit in goose.lock.
You can specify a name and version tag:
goose add https://github.com/user/somelib.git --name mylib --version v1.0.0Then include its headers in your code:
#include <somelib.h>Create a tests/ directory with .c files. Each test file must have its own main():
// tests/basic.c
#include <assert.h>
#include <stdio.h>
int main(void) {
assert(1 + 1 == 2);
printf("passed\n");
return 0; // 0 = pass, non-zero = fail
}Run all tests:
goose testgoose clean # removes build/ directory- Read the Configuration Reference for all goose.yaml options
- Read Dependencies to learn about package management
- Read Creating Packages to publish your own library
- Read Plugins to use custom transpilers (flex, bison, etc.)
- Read Using libgoose.a to embed goose in your own tools
- See the examples/ directory for working examples