Skip to content

[Darwin] Use FSEvents when target_os has no version number - #598

Open
klizas wants to merge 1 commit into
guard:masterfrom
klizas:darwin-adapter-optional-os-version
Open

[Darwin] Use FSEvents when target_os has no version number#598
klizas wants to merge 1 commit into
guard:masterfrom
klizas:darwin-adapter-optional-os-version

Conversation

@klizas

@klizas klizas commented Aug 19, 2026

Copy link
Copy Markdown

On Ruby configured with --with-os-version-style=none, RbConfig::CONFIG['target_os'] is a bare darwin rather than e.g. darwin24. OS_REGEXP required (1|2)\d+, so usable? returned false, and since no other adapter is usable on macOS, Listen fell back to polling.

[Listen warning]:
  Listen will be polling for changes.Learn more at https://github.com/guard/listen#listen-adapters.

Distributors use that configure option so RUBY_PLATFORM stays stable across macOS releases, where it is otherwise derived from the build machine's kernel. Either way target_os is a cosmetic build string, so it says nothing about whether FSEvents is available.

This PR makes the version optional and treats an absent version as usable. The rb-fsevent check still runs when a version is present and older than darwin13, so OS X 10.6-10.8 is unaffected. \A is needed because an optional capture group would otherwise let the pattern match darwin anywhere in the string. As a side effect the pattern now also matches darwin30 and later, which (1|2)\d+ did not.

Comment thread lib/listen/adapter/darwin.rb Outdated
Comment thread lib/listen/adapter/darwin.rb Outdated
@LouisaNikita

LouisaNikita commented Aug 19, 2026 via email

Copy link
Copy Markdown

Ruby configured with `--with-os-version-style=none` reports a bare
`darwin` in `RbConfig::CONFIG['target_os']` instead of e.g. `darwin24`.
`OS_REGEXP` required `(1|2)\d+`, so `usable?` returned false on those
builds and Listen fell back to polling.
@klizas
klizas force-pushed the darwin-adapter-optional-os-version branch from 05c0379 to 05d2962 Compare August 19, 2026 18:39
@klizas
klizas requested a review from houndci-bot August 19, 2026 18:41
@klizas
klizas marked this pull request as ready for review August 19, 2026 18:45
@klizas klizas changed the title Use FSEvents when target_os has no version number [Darwin] Use FSEvents when target_os has no version number Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants