Skip to content

kqueue watcher cannot recursively watch root directory #703

Description

@valentinegb

When attempting to recursively watch the root directory (/) using KqueueWatcher, Watcher::watch returns "No such file or directory (os error 2)".

MRE

# Cargo.toml
[package]
name = "notify_kqueue_mre"
edition = "2024"

[dependencies]
notify = { version = "8.1.0", default-features = false, features = ["macos_kqueue"] }
// src/main.rs
use std::{path::Path, sync::mpsc::channel};

use notify::{Config, KqueueWatcher, RecursiveMode, Watcher as _};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let (sender, receiver) = channel();
    let mut watcher = KqueueWatcher::new(sender, Config::default())?;

    watcher.watch(Path::new("/"), RecursiveMode::Recursive)?;

    for _result in receiver {
        // ...
    }

    Ok(())
}

This MRE outputs the following:

Error: Error { kind: Generic("No such file or directory (os error 2)"), paths: [] }

Environment

notify: 8.1.0
Rust: 1.87.0
OS: macOS 26.0 Beta (25A5306g)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions