olcli icon indicating copy to clipboard operation
olcli copied to clipboard

Homebrew formula installs no binary: dist/ never built

Open floswald opened this issue 2 weeks ago • 2 comments

Problem

brew install aloth/tap/olcli completes without error and reports the formula as linked, but the olcli command is not available afterward (command not found).

Root cause

The formula (.brew/olcli.rb) builds from the GitHub release tarball:

def install
  system "npm", "install", *std_npm_args(ignore_scripts: false)
  bin.install_symlink Dir["#{libexec}/bin/*"]
end

npm install here only installs production dependencies and packs/installs the package per package.json's "files" field:

"files": ["dist", "README.md", "LICENSE"]

Since there is no prepare script (only a build script running tsc), and dist/ is not checked into the repo, dist/cli.js — the target of the bin.olcli entry — never gets created. As a result:

  • libexec/lib/node_modules/@aloth/olcli/dist does not exist
  • libexec/bin is never populated by npm (nothing for Dir["#{libexec}/bin/*"] to match)
  • bin.install_symlink symlinks nothing into /opt/homebrew/bin
  • olcli is simply missing after install, even though brew list olcli and brew link report success

I verified this by inspecting the Cellar install:

$ ls /opt/homebrew/Cellar/olcli/0.17.0/libexec/lib/node_modules/@aloth/olcli/dist
ls: No such file or directory

Also note: the installed copy under libexec only contains the files whitelisted in "files" (dist, README, LICENSE) — src/ and tsconfig.json are not present there, so there's no way to build in place after the fact either; a real build has to happen before packing.

Suggested fix

Have the formula build before installing, e.g.:

def install
  system "npm", "install", *std_npm_args(ignore_scripts: false)
  system "npm", "run", "build"
  bin.install_symlink Dir["#{libexec}/bin/*"]
end

(this needs devDependencies installed too, since tsc is a devDependency — std_npm_args may need production: false, or build should happen against the full source checkout before npm packs/prunes to production deps)

or alternatively, commit a pre-built dist/ to the tagged release so the tarball Homebrew pulls already contains compiled output.

Workaround

Installing via npm directly works fine, since the published npm package ships a prebuilt dist/:

npm install -g @aloth/olcli

Environment

  • macOS, Apple Silicon (/opt/homebrew)
  • brew install aloth/tap/olcli → olcli 0.17.0
  • node 26.13.1 (via brew)

floswald avatar Nov 16 '26 10:11 floswald

Thanks for the detailed report, the diagnosis is right. One detail: package.json does have a prepare script that runs the build, but Homebrew's npm helper deletes prepare, prepack and postpack from package.json before it packs the package, so the build never runs. The GitHub source tarball has no dist/, so the packed package contains only package.json, README.md and LICENSE, and nothing gets linked into bin.

The formula now installs from the npm registry tarball instead, which is the same prebuilt package that npm install -g uses. After brew update, brew reinstall olcli gives you a working olcli 0.18.0. The release workflow now also runs brew install and brew test on macOS after each formula bump, so a formula that installs no binary fails the release instead of shipping.

aloth avatar Nov 16 '26 15:11 aloth

Great! Very nice package, been looking for this for a long time.

floswald avatar Nov 16 '26 15:11 floswald