Skip to content

Installation

Refringe edited this page Oct 28, 2026 · 7 revisions

Installation

Downloading a Release

Releases after v0.1.4 attach an archive for Linux, macOS and Windows on amd64 and arm64 to the release page, with a checksums.txt. Each archive holds the static anchor-lfs binary (anchor-lfs.exe on Windows), LICENSE, README.md and config.toml.example.

With the GitHub CLI, download the newest release for your platform, check it, and unpack it:

gh release download --repo refringe/anchor-lfs --pattern '*_linux_amd64.tar.gz' --pattern checksums.txt
sha256sum --check --ignore-missing checksums.txt
gh attestation verify anchor-lfs_*_linux_amd64.tar.gz --repo refringe/anchor-lfs
tar -xzf anchor-lfs_*_linux_amd64.tar.gz

gh attestation verify confirms the archive was built by this repository's release workflow from the tagged commit. On macOS, use shasum -a 256 if sha256sum is missing. A binary downloaded with a browser on macOS is quarantined; clear it with xattr -d com.apple.quarantine anchor-lfs.

Prerequisites

  • Go 1.27 or later (for building from source)
  • Git (for cloning the repository and version detection)

Building from Source

Clone the repository and build:

git clone https://github.com/refringe/anchor-lfs.git
cd anchor-lfs
make build

The compiled binary is placed at bin/anchor-lfs. The build embeds version metadata (Git tag, commit hash, and build date) into the binary via linker flags. It is a static binary (CGO_ENABLED=0), so it runs on any Linux distribution, including Alpine and distroless images.

Build Targets

Command Description
make build Compile a static binary (CGO_ENABLED=0) to bin/anchor-lfs
make run Build and immediately run the server
make dist Build the release archives for every platform, with checksums.txt, in dist/
make clean Remove build artefacts (bin/, dist/ and coverage.out)

Manual Build

If you prefer not to use Make:

CGO_ENABLED=0 go build -trimpath \
  -ldflags="-s -w -X main.version=$(git describe --tags --always --dirty) -X main.commit=$(git rev-parse --short HEAD) -X main.date=$(date -u '+%Y-%m-%dT%H:%M:%SZ')" \
  -o bin/anchor-lfs .

Without the -X flags, version reports dev.

Verifying the Build

After building, print the embedded version info (no config file needed):

./bin/anchor-lfs version
# anchor-lfs v0.2.0 (commit abc1234, built 2026-01-01T00:00:00Z)

./bin/anchor-lfs help lists the commands, and ./bin/anchor-lfs check validates your config.toml. A running server also reports its version at the root endpoint:

./bin/anchor-lfs &
curl -s http://localhost:5420/ | jq .
# {"version": "v0.2.0"}

Next Steps

Clone this wiki locally

⌂ 换网址