Skip to content
Latchkey

macOS runner: "No such file or directory @ rb_sysopen" (Ruby/gem) in CI

Ruby raised Errno::ENOENT from rb_sysopen, meaning a file open failed because the path is missing. In CI this is usually a path that exists locally but not on the runner: a config, a vendored asset, or a tool a gem expects.

What this error means

A Ruby tool (Fastlane, CocoaPods, a Rake task) fails with "No such file or directory @ rb_sysopen - <path> (Errno::ENOENT)".

Ruby
/Library/Ruby/Gems/.../lib/foo.rb:12:in `read': No such file or directory @ rb_sysopen -
/Users/runner/work/app/config/secret.json (Errno::ENOENT)

Common causes

A file present locally is absent in CI

An untracked config, a gitignored secret, or a generated file that is not produced in CI leaves the path missing when the gem opens it.

A relative path resolves from the wrong directory

The step runs from a different working directory than expected, so a relative open targets a path that does not exist.

How to fix it

Provide the missing file or generate it

  1. Read the exact path in the rb_sysopen message.
  2. Write the file from a secret, or run the step that generates it, before the failing command.
  3. Re-run the Ruby tool.
Terminal
mkdir -p config
printf '%s' "$SECRET_JSON" > config/secret.json

Run from the correct working directory

Set the step working directory so relative paths resolve to files that actually exist in the checkout.

.github/workflows/ci.yml
defaults:
  run:
    working-directory: ./app

How to prevent it

  • Materialize required config and secret files before Ruby steps.
  • Use absolute or workspace-rooted paths in CI scripts.
  • Set the working directory so relative opens resolve correctly.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →