# fs: Replace MacWatcher with notify::FsEventWatcher \(\#47322\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/b1f9ca96ec263352024edbf515a784b657a6bc3d)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: b1f9ca96ec263352024edbf515a784b657a6bc3d

Requested commit: b1f9ca96ec263352024edbf515a784b657a6bc3d

Commit: b1f9ca96ec263352024edbf515a784b657a6bc3d

Tree: 91dc4dbe876d2906ade00c4143886fe1f9aa0ad4

Author: Marco Mihai Condrache

Committer: GitHub

## Message

```
fs: Replace MacWatcher with notify::FsEventWatcher (#47322)

Closes #47064 
Closes #20806

The previous implementation used Zed's custom fsevent crate, which
spawned a dedicated thread for each watched path. On large projects,
this could result in 100+ threads just for filesystem watching.

This PR removes the `fsevent` crate and switches to using `notify's`
FsEventWatcher directly. The notify implementation maintains a single
FSEvents stream that watches all paths on one thread. When paths are
added or removed, the stream is stopped, the path list is updated, and
the stream is restarted.

Ref: https://github.com/notify-rs/notify/blob/main/notify/src/fsevent.rs

As a result, Zed now uses one thread for filesystem watching regardless
of how many paths are watched.

Release Notes:

- On macOS, Zed now uses significantly fewer resources when watching
filesystem changes

---------

Signed-off-by: Marco Mihai Condrache <52580954+marcocondrache@users.noreply.github.com>
Co-authored-by: Anthony Eid <anthony@zed.dev>
```

## Parents

- [4ffe748461cbe39eaa84b3074a198b61c8464255](https://git.cafe/gitcafe/zed/commit/4ffe748461cbe39eaa84b3074a198b61c8464255?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/b1f9ca96ec263352024edbf515a784b657a6bc3d?format=markdown)
