$ uname -a A_BLOG_ABOUT_UNIX_TOOLS_AND_THE_BEAUTY_OF_SIMPLE_SYSTEMS
SYS.YEAR  2026
← Back to articles
2026-11-24ARTICLE

Github Starter

FreeBSD builds on GitHub: a beginner's guide

Projects: fd (Rust file finder) and krep (C text-search tool)
Updated: November 23, 2026
Goal: Create GitHub forks, build real FreeBSD executables with GitHub Actions, download the binaries, keep the forks updated, and propose useful fixes upstream.

Start here: Follow the sections in order. Do fd first; use krep to learn how to diagnose a portability problem. The sample workflows are starting points, not builds verified for your particular commits. If a step fails, read the Actions log and adjust it before proceeding.

The big picture (five definitions)

  • Repository (repo): A project's files and change history stored by Git.
  • Upstream: The original project, such as sharkdp/fd.
  • Fork: Your copy of an upstream repository on GitHub. Your experiments do not change upstream.
  • Branch: A separate line of changes inside one repo. We'll keep a clean upstream branch and a freebsd-build branch.
  • GitHub Actions workflow: A .yml file in .github/workflows/ that tells GitHub when and how to execute commands. Artifact means a downloadable file saved from a workflow run; Release asset means a file attached to a longer-lived GitHub Release.

Our structure:

Original GitHub repos                  Your public GitHub organization
sharkdp/fd -------------------------> YOUR_ORG/fd
                                         master        (clean upstream tracking)
                                         freebsd-build (FreeBSD workflow)

davidesantangelo/krep --------------> YOUR_ORG/krep
                                         main          (clean upstream tracking)
                                         freebsd-build (FreeBSD workflow)

The goal isn't to maintain permanent alternative versions of these programs. It's to build FreeBSD support, investigate problems, and contribute the useful work back upstream.

1. Create a free personal GitHub account

Already have an account? Skip this section.

  1. Visit https://github.com/signup and follow the prompts to choose a username, email address, and login method.
  2. Verify your email address when GitHub asks.
  3. Set up two-factor authentication and save your recovery codes somewhere secure. A passkey or authenticator app is preferable to relying only on a password.
  4. Sign in at https://github.com. You now have a personal account.

Reference: GitHub — Getting started with your account.

2. Create an organization (recommended, optional)

An organization is a shared home for repositories, even if you're its only member. A free organization is sufficient for this project.

  1. While signed in, visit https://github.com/settings/organizations.
  2. Click New organization and select the free plan.
  3. Choose a unique name such as your-freebsd-ci-lab (only if available).
  4. Complete the setup. You are the initial owner; you do not need to create a second personal account.

From now on, replace YOUR_ORG in every example with your actual organization name. If you prefer not to create an organization, use your GitHub username instead. Don't use an organization name that suggests official FreeBSD Project or FreeBSD Foundation affiliation without permission.

Reference: Create an organization.

3. Install the tools on FreeBSD

On your FreeBSD workstation or VM, open a terminal. If your account has sudo configured:

sudo pkg install -y git gh gmake rust actionlint

If you don't have sudo, become root, install the packages, then return to your normal account:

su -
pkg install -y git gh gmake rust actionlint
exit

What these tools do: git tracks changes; gh talks to GitHub; gmake is GNU Make; rust includes the Rust compiler and Cargo; actionlint checks workflow syntax.

Tell Git who you are (replace the examples):

git config --global user.name "Your Name"
git config --global user.email "you@example.com"

Authenticate gh with the account you created:

gh auth login

Choose GitHub.com, HTTPS, and Log in with a web browser when prompted. Follow the browser instructions. Then check:

gh auth status
gh auth setup-git

Never put passwords, personal access tokens, or other secrets into a workflow YAML file.

References: GitHub CLI manual, Git setup.

4. Fork both projects using the website

A fork is created once for each project.

  1. Open https://github.com/sharkdp/fd.
  2. Click Fork (top right). Choose YOUR_ORG as the owner and keep the fork public.
  3. Click Create fork. Your fork should appear at https://github.com/YOUR_ORG/fd.
  4. Repeat for https://github.com/davidesantangelo/krep, creating https://github.com/YOUR_ORG/krep.
  5. Open each fork's Actions tab. If GitHub asks you to enable workflows for the fork, review and enable them. Existing upstream workflows may run too; disable any irrelevant workflows if needed.

References: Fork a repo, Manage Actions settings.

5. Clone your forks onto FreeBSD

A clone is a working copy on your own computer.

mkdir -p ~/src/freebsd-builds
cd ~/src/freebsd-builds

gh repo clone YOUR_ORG/fd
gh repo clone YOUR_ORG/krep

Configure a second remote called upstream (the original author). In each folder, first inspect the remotes:

cd ~/src/freebsd-builds/fd
git remote -v

If an upstream remote is not already shown, add it:

git remote add upstream https://github.com/sharkdp/fd.git

Repeat for krep:

cd ~/src/freebsd-builds/krep
git remote -v
# Only if 'upstream' is missing:
git remote add upstream https://github.com/davidesantangelo/krep.git

origin means your fork; upstream means the original repo. Check branch names with git branch --show-current: fd normally uses master; krep uses main.

6. Create an experimental branch in each fork

Keep master (fd) and main (krep) unchanged so they are easy to sync. Put your workflow in a new branch.

cd ~/src/freebsd-builds/fd
git switch -c freebsd-build

cd ~/src/freebsd-builds/krep
git switch -c freebsd-build

You will push this new branch after adding its workflow. Initially, a push-triggered workflow is simplest: it can run on your experimental branch without changing your fork's default branch. Later, for manual workflow_dispatch runs and scheduled builds, put the workflow on the fork's default branch or make freebsd-build the fork's default branch (see Section 12).

7. First try a local FreeBSD build: fd

cd ~/src/freebsd-builds/fd
cargo --version
cargo build --release --locked
./target/release/fd --version

Expected output: an fd version, if the build succeeds. This is a local build on your FreeBSD computer; GitHub is not involved yet. The FreeBSD package is called fd-find, although the executable is fd.

If you get a Rust version error, update the Rust toolchain/package. If you get an error about dependencies, read the first meaningful error rather than just the final failure line.

References: fd source and development instructions, FreeBSD fd port.

8. Add the fd GitHub Actions workflow

Still on branch freebsd-build, create the directory and open a new file in your editor:

cd ~/src/freebsd-builds/fd
mkdir -p .github/workflows
vi .github/workflows/freebsd.yml

If you prefer another editor, use it instead of vi. Paste all of the following YAML:

name: FreeBSD binary build

on:
  push:
    branches: [freebsd-build]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  freebsd-amd64:
    runs-on: ubuntu-latest
    timeout-minutes: 120

    steps:
      - name: Check out source
        uses: actions/checkout@v4

      - name: Compile on FreeBSD
        uses: vmactions/freebsd-vm@v1
        with:
          release: "14.5"
          arch: x86_64
          sync: rsync
          prepare: |
            pkg install -y rust
          run: |
            set -eu
            CARGO_TARGET_DIR=/tmp/fd-target cargo build --release --locked
            /tmp/fd-target/release/fd --version
            mkdir -p artifacts
            tar -czf artifacts/fd-freebsd14-amd64.tar.gz \
              -C /tmp/fd-target/release fd
            sha256 artifacts/fd-freebsd14-amd64.tar.gz \
              > artifacts/fd-freebsd14-amd64.sha256

      - name: Save downloadable files
        uses: actions/upload-artifact@v4
        with:
          name: fd-freebsd14-amd64
          path: artifacts/
          if-no-files-found: error

What it does:

  1. GitHub starts a standard Ubuntu runner.
  2. vmactions/freebsd-vm boots a real FreeBSD VM inside it.
  3. pkg install provides Rust; Cargo compiles fd natively inside FreeBSD.
  4. The VM writes a versioned archive and checksum under artifacts/.
  5. sync: rsync copies these files back to the Ubuntu runner; upload-artifact saves them for download.

The Rust compilation output is placed in /tmp/fd-target to avoid synchronizing the large Cargo build tree back to GitHub. Only the archive and checksum need to be uploaded. The workflow uses a specific FreeBSD release for consistency; update that release deliberately later.

Check syntax and save:

actionlint .github/workflows/freebsd.yml
git status
git add .github/workflows/freebsd.yml
git commit -m "Add experimental FreeBSD binary build"
git push -u origin freebsd-build

git commit saves the change in your local Git history. git push uploads it to your fork. The push event starts the workflow automatically.

Reference: vmactions/freebsd-vm.

9. Watch GitHub run the workflow and download fd

  1. Open https://github.com/YOUR_ORG/fd/actions.
  2. Open the FreeBSD binary build workflow and select the newest run for freebsd-build.
  3. Click the job, then each step, to see logs. A green check means it completed; a red X means investigate the error.
  4. If successful, find the Artifacts section on the run's summary page. Download fd-freebsd14-amd64.
  5. Extract the downloaded artifact ZIP. Inside are the .tar.gz archive and .sha256 checksum file.

Or use gh:

gh run list --repo YOUR_ORG/fd --branch freebsd-build
gh run watch --repo YOUR_ORG/fd
gh run download --repo YOUR_ORG/fd

The last command may prompt you to select a run/artifact. GitHub Actions artifacts expire according to retention settings (public repositories can configure up to 90 days). They aren't the same as GitHub Releases.

Optional test on a compatible FreeBSD amd64 system: unpack the binary archive and run ./fd --version from its extracted folder. A successful compilation plus version check is a smoke test, not proof of full functionality or portability across all FreeBSD releases.

10. Investigate and build krep locally

This is a different type of exercise. The upstream Makefile has used CC = gcc, which can be a problem on a standard FreeBSD system where the default C compiler is cc (Clang). The FreeBSD port has had Makefile portability patches. First verify what the current upstream source actually needs; never assume an old patch is still required.

cd ~/src/freebsd-builds/krep
# You should still be on freebsd-build:
git branch --show-current

# Try the documented upstream build command first:
gmake

If it fails because gcc is not installed, try overriding the Makefile's compiler selection without changing any source files:

gmake CC=cc

If a partial build is left behind, try gmake clean before retrying. If the build completes:

./krep -v

Compare the Makefile with the FreeBSD port's patches:

If you have the Ports tree installed locally, inspect /usr/ports/textproc/krep/files/ too. Files in that directory may patch build configuration, source code, or packaging; investigate them individually. Note whether you tested main or a particular release tag, and save the exact error messages.

11. Add the krep workflow

cd ~/src/freebsd-builds/krep
mkdir -p .github/workflows
vi .github/workflows/freebsd.yml

Paste this separate workflow, tailored to krep:

name: FreeBSD binary build

on:
  push:
    branches: [freebsd-build]
  workflow_dispatch:

permissions:
  contents: read

jobs:
  freebsd-amd64:
    runs-on: ubuntu-latest
    timeout-minutes: 60

    steps:
      - name: Check out source
        uses: actions/checkout@v4

      - name: Compile on FreeBSD
        uses: vmactions/freebsd-vm@v1
        with:
          release: "14.5"
          arch: x86_64
          sync: rsync
          prepare: |
            pkg install -y gmake
          run: |
            set -eu
            gmake CC=cc
            test -x ./krep
            mkdir -p artifacts
            tar -czf artifacts/krep-freebsd14-amd64.tar.gz krep
            sha256 artifacts/krep-freebsd14-amd64.tar.gz \
              > artifacts/krep-freebsd14-amd64.sha256

      - name: Save downloadable files
        uses: actions/upload-artifact@v4
        with:
          name: krep-freebsd14-amd64
          path: artifacts/
          if-no-files-found: error

This deliberately uses gmake CC=cc, a command-line workaround rather than an upstream patch. If the build still fails (e.g. because of flags, headers, or SIMD assumptions), that's the portability problem to investigate. Don't publish a release until you can at least run the executable successfully on FreeBSD.

actionlint .github/workflows/freebsd.yml
git add .github/workflows/freebsd.yml
git commit -m "Add experimental FreeBSD binary build"
git push -u origin freebsd-build

Visit https://github.com/YOUR_ORG/krep/actions to see whether it builds. Save the failing log if it doesn't. Your first result can simply be a reproducible failure with a clear explanation.

12. Keep your forks up to date

Start with manual updates, perhaps weekly. These commands preserve the freebsd-build branch and its workflow. Don't force-reset a branch containing your changes.

For fd (upstream uses master):

cd ~/src/freebsd-builds/fd
git fetch upstream
git switch master
git merge --ff-only upstream/master
git push origin master

git switch freebsd-build
git merge master
git push origin freebsd-build

For krep (upstream uses main):

cd ~/src/freebsd-builds/krep
git fetch upstream
git switch main
git merge --ff-only upstream/main
git push origin main

git switch freebsd-build
git merge main
git push origin freebsd-build

Each push to freebsd-build triggers another FreeBSD CI run. If Git reports a merge conflict, stop and read its instructions; resolve the conflicting file, git add it, and complete the merge. Don't force-push unless you understand the consequences.

Optional later — manual buttons and scheduled builds: The workflow already declares workflow_dispatch, but GitHub requires the workflow to exist on the fork's default branch to be dispatched. You can change the fork's default branch to freebsd-build under Settings → Branches → Default branch. Then the Run workflow button becomes available. If you later add a schedule: trigger, scheduled workflows run on the default branch and are disabled by default when a public repository is forked; enable them explicitly.

References: Syncing a fork, Workflow triggers.

13. Make a portability fix and propose it upstream

Suppose you find a real krep Makefile issue. First verify that the fix isn't already present in a newer upstream commit or open pull request.

Create a fresh branch based on upstream, not on freebsd-build. That way, your patch PR won't accidentally include the unrelated CI workflow:

cd ~/src/freebsd-builds/krep
git fetch upstream
git switch -c fix/freebsd-makefile upstream/main
  1. Edit the smallest possible part of the Makefile or source. For example, make compiler selection respect FreeBSD's default cc or user-provided CC, if that is truly the failure.
  2. Build without the command-line workaround you previously needed, and run a small test. Verify you didn't break the original behavior.
  3. Review the change:
git diff
git status
git add Makefile
git commit -m "Make compiler selection portable on FreeBSD"
git push -u origin fix/freebsd-makefile
  1. Open your branch on GitHub. Click Compare & pull request, set the base repository to davidesantangelo/krep and base branch to main, and submit the PR.
  2. Explain briefly: problem → reproduction command → cause → fix → FreeBSD build result. Link to your FreeBSD Actions run if helpful.
  3. Respond to reviewer feedback. If upstream merges the fix, synchronize your fork and remove any duplicate workaround from freebsd-build.

For fd, follow the same pattern but use upstream/master as the starting point. A CI workflow PR and a source portability-fix PR can be separate contributions—upstream might accept one before the other.

Reference: Create a pull request from a fork.

14. Optional: publish unofficial FreeBSD GitHub Releases

Start with Actions artifacts. Once a build and smoke test are reliable:

  1. From a successful Actions run, download the .tar.gz file and its checksum.
  2. Check that the binary runs on FreeBSD, and that your redistribution archive includes required license notices and relevant documentation. A bare executable alone may not make a suitable public release package.
  3. Open your fork's Releases page, click Draft a new release, and create a clearly unofficial tag such as freebsd-fd-vX.Y.Z-1 pointing at the exact tested fork commit. Replace X.Y.Z with the version you actually built.
  4. Attach the archive and checksum. Explain the FreeBSD version/architecture, source commit, build workflow, limitations, and that this is unofficial and not an upstream release.
  5. Publish the release on your fork, not the upstream project. Later, a maintainer may choose to adopt the same build in the official upstream release workflow.

Important: A binary compiled on FreeBSD 14.5 is not necessarily a portable binary for every 14.x or 15.x machine; dynamic library dependencies and supported CPUs matter. Check with ldd ./program on FreeBSD. Test each FreeBSD release/architecture you claim to support. Keep checksums and source versions traceable.

Reference: Managing GitHub Releases.

15. Common problems and what to check

Symptom First thing to check
git push asks for credentials or fails Run gh auth status and gh auth setup-git; verify access to the fork.
No Actions run appears Confirm that .github/workflows/freebsd.yml was pushed to freebsd-build, Actions are enabled, and the YAML has a push trigger for that branch.
workflow_dispatch button missing The workflow must also exist on the default branch. Use a push-triggered build first.
actionlint reports an error Read its line number; indentation is meaningful in YAML.
cargo/gmake fails in the VM Expand the FreeBSD action's logs and find the first build error. Retry the same command locally on FreeBSD.
Archive isn't uploaded Check the artifacts/ path and sync: rsync; look for an earlier failure before the upload step.
krep says gcc: not found Try gmake CC=cc; decide whether the upstream Makefile needs a portable default.
Build passes but executable fails A successful compile is not a complete test. Check CPU features, libraries, startup behavior and command options.
Fork won't sync cleanly Update the clean upstream-tracking branch first, then merge into freebsd-build. Avoid reset/force-push.
Big build exhausts resources Use small smoke builds, external /tmp target directories, and fewer parallel jobs.

16. Recommended first milestones

  • GitHub personal account secured with 2FA.
  • Free GitHub organization created (or choose to use personal account).
  • Public fd and krep forks created.
  • gh auth status succeeds on FreeBSD.
  • Both forks cloned with an upstream remote.
  • fd builds locally with Cargo.
  • fd freebsd-build branch uploads a FreeBSD archive to Actions.
  • krep built locally or the first failure documented.
  • krep freebsd-build branch uploads an archive or reproduces a useful failure.
  • Both forks synchronized with upstream at least once.
  • One small, focused upstream PR submitted.

Useful reference links

Final distinction: Your fork can produce unofficial FreeBSD build artifacts and releases immediately. It becomes official upstream FreeBSD CI or release support only if the original maintainers accept and operate those workflows or publish the binaries themselves.