# Force watcher type

**URL:** https://forum.syncthing.net/t/force-watcher-type/22284
**Category:** Support
**Created:** [June 11, 2024, 10:50pm UTC](https://forum.syncthing.net/t/force-watcher-type/22284 "2024-06-11T22:50:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![tucari](https://forum.syncthing.net/user_avatar/forum.syncthing.net/tucari/32/10654_2.png) [@tucari](https://forum.syncthing.net/u/tucari)
#### Post date: [June 11, 2024, 10:50pm UTC](https://forum.syncthing.net/t/force-watcher-type/22284/1 "2024-06-11T22:50:00Z")

</div>

Hi all,

Is there a simple way to force which filesystem watcher is used for events? I.e can I force kqueue to be used instead of FSEvents on MacOS?

Thanks

---

<div class="post-metadata">

### Author: ![calmh](https://forum.syncthing.net/user_avatar/forum.syncthing.net/calmh/32/15311_2.png) [@calmh](https://forum.syncthing.net/u/calmh)
#### Post date: [June 12, 2024, 6:09am UTC](https://forum.syncthing.net/t/force-watcher-type/22284/2 "2024-06-12T06:09:36Z")

</div>

It looks like you should be able to build with `go run build.go -tags kqueue`, but it doesn’t work out of the box, the following patch makes it build:

```diff
diff --git a/lib/fs/basicfs_watch_eventtypes_kqueue.go b/lib/fs/basicfs_watch_eventtypes_kqueue.go
index c8e34dfd6..bc233cf82 100644
--- a/lib/fs/basicfs_watch_eventtypes_kqueue.go
+++ b/lib/fs/basicfs_watch_eventtypes_kqueue.go
@@ -4,8 +4,8 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at http://mozilla.org/MPL/2.0/.

-//go:build dragonfly || freebsd || netbsd || openbsd
-// +build dragonfly freebsd netbsd openbsd
+//go:build dragonfly || freebsd || netbsd || openbsd || kqueue
+// +build dragonfly freebsd netbsd openbsd kqueue

 package fs

diff --git a/lib/fs/basicfs_watch_notkqueue.go b/lib/fs/basicfs_watch_notkqueue.go
index 7d529cc27..49816156b 100644
--- a/lib/fs/basicfs_watch_notkqueue.go
+++ b/lib/fs/basicfs_watch_notkqueue.go
@@ -4,8 +4,8 @@
 // License, v. 2.0. If a copy of the MPL was not distributed with this file,
 // You can obtain one at http://mozilla.org/MPL/2.0/.

-//go:build !dragonfly && !freebsd && !netbsd && !openbsd
-// +build !dragonfly,!freebsd,!netbsd,!openbsd
+//go:build !dragonfly && !freebsd && !netbsd && !openbsd && !kqueue
+// +build !dragonfly,!freebsd,!netbsd,!openbsd,!kqueue

 package fs

```

Obviously, this has never been tested by anyone, but it might work.

---

<div class="post-metadata">

### Author: ![tucari](https://forum.syncthing.net/user_avatar/forum.syncthing.net/tucari/32/10654_2.png) [@tucari](https://forum.syncthing.net/u/tucari)
#### Post date: [June 12, 2024, 12:52pm UTC](https://forum.syncthing.net/t/force-watcher-type/22284/3 "2024-06-12T12:52:47Z")

</div>

Amazing, thankyou!! Will give this a go.

---

<div class="post-metadata">

### Author: ![system](https://forum-uploads.syncthingcdn.net/original/2X/0/0b50e0a202b22ae6a67190759e8c868805b8ed9f.png) [@system](https://forum.syncthing.net/u/system)
#### Post date: [July 12, 2024, 12:53pm UTC](https://forum.syncthing.net/t/force-watcher-type/22284/4 "2024-07-12T12:53:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
