Netlify cli hanging on osx

Up until last week, I primarily used the Netlify CLI via Ubuntu (well, WSL). In the past week I’ve tried to use it twice in OSX, using latest Node, latest CLI version, etc, and after it starts Eleventy, it begins to cycle an infinite number of errors in terminal and processes. I’ve pasted the error below.

This is how I’m running it:

netlify dev -c "eleventy --serve --quiet"

This same command worked fine on my Windows machine. I can say it gets Eleventy started, what I see is the usual start up stuff, but then it just cycles the error below.

same issue for the last 2 days - seems like whatever update they made is crashing with node js versions or somethin

As an FYI, this still exists in the latest released version.

Filed here: Infinite repeating error message · Issue #7763 · netlify/cli · GitHub

As just an FYI, this is still a problem with the latest CLI + Node 26.1. Does anyone have any kind of workaround?

I’m unable to reproduce this. Just created a bare minimum 11ty site and CLI works fine. Node v24, CLI v26.

Could you try with my repo? GitHub - cfjedimaster/raymondcamden2023: The new, *new* repository for my blog. · GitHub

I’ll also note this is being reproduced in other apps as well: Infinite error loop when using new netlify-cli (Netlify Database) · Issue #8231 · netlify/cli · GitHub

I did and I’m getting:

Untappd loading error TypeError: Cannot read properties of undefined (reading ‘items’)
at default (file:///Users/hrishikesh/repos/f-157384-2/src/_data/untappd_beers.js:17:37)

Maybe I’m missing some env vars or something, but the CLI is unable to load (at least on my device) due to this.

In any case, this not happening in a minimal reproduction is going to be a major blocker as for the most part, we cannot advise for project-specific configurations. If this happens for a wider audience, it’s likely an us issue, but if it’s happening for a very small number of users with their specific setups, that would be very hard to narrow down.

I checked the linked issue and also tried that repo. An interesting bit they mentioned that it’s only happening on Intel Mac for them, not on M chip - and I’m noticing the same thing. It’s working on my M5 MacBook, but I’m not sure if we have any Intel based MacBooks lying around. Are you on an Intel based Mac as well?

Nope, M chip. I just pushed a fix for the Untappd key being missing. Could you do a quick check again?

Okay so this error is specific to your setup. The error is:

error: EMFILE: too many open files, watch
  at FSWatcher._handle.onchange (node:internal/fs/watchers:267:21) {
  errno: -24,
  syscall: 'watch',
  code: 'EMFILE',
  filename: null
}

Looks like the CLI is trying to watch files or directories for changes and the Operating System is simply not allowing that. You can try: https://stackoverflow.com/a/21201405

Didn’t help. Also, in theory anyway, my local Eleventy setup ignores 90% of my files. Also, Netlify itself can build the site just fine.

This PR: fix: infinite loop on error by hrishikesh-k · Pull Request #8269 · netlify/cli · GitHub should at least prevent the error loop + start logging the error message so users aren’t left in the dark about the actual issue. So the “hanging” at least should be solved.

As for the original issue, I’m not sure what can be done. The OS is blocking the CLI from watching files leading to this issue. I’ll see if there’s anything the CLI can do here, but I’m doubtful at the moment.

I’m not seeing it in help, but is there a way to make ntl dev also ignore files?

I just did a test - copied my project and then deleted like 16 years of blog posts and I can confirm it works.

So - given I got it to work with fewer files, I used a git sparse-checkout to greatly reduce the size of the src directory. It is currently at 1080 files, which isn’t a lot… but still fails.

I checked this today further and found 1 issue with the CLI: The Edge Functions watch your publish directory as well (in your case _site/**). Your src folder has about 11k files and the _site folder has about 13.7k. In total, this was going way over MacOS’ limits.

I tried manually excluding only the _site directory, but the issue still persisted due to the src directory’s file count. Since it’s not safe to automatically exclude src for everyone, I have now added a --watch-ignore flag for the dev command. So you can now run:

netlify dev -c "eleventy --serve --quiet" --watch-ignore src

The flag can be specified multiple times to exclude different files/directories. Since in your case Eleventy will handle the watching and reloading of the files, I think you can potentially exclude the entire directory, but I haven’t tested your setup too deeply to confirm that.

With that being said, the feature is just a PR at the moment. so I’m not sure if it will be shipped or not. You can follow the progress here: feat: add watch-ignore flag by hrishikesh-k · Pull Request #8271 · netlify/cli · GitHub