Changing fs.inotify.max_user_watches

Hi there,

As part of the React Native packager facebook uses watchman which in turn uses inotify. The default limits specified by ubuntu are low

ubuntu@box324:~$ cat /proc/sys/fs/inotify/max_user_watches

So they suggest running (from here:

echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

The problem is I get

sysctl: permission denied on key ‘fs.inotify.max_user_watches’

When running that command on CircleCI. How can I set that parameter so my React build could work?

Many thanks


I’m running into the same issue, did you solve it?

I’ve had success using:

- sudo sysctl fs.inotify.max_user_watches=524288
- sudo sysctl -p

as part of the build setup to just set the limit temporarily. YMMV…

How to do that if you use the docker executor?

Since sudo is not allowed there…


So, how do you set “max_user_watches” on the host machine if you use the Docker executor?

1 Like

Since inotify limits cannot be raised in the Circle 2.0 docker, I’ve gotten successful builds (and deploys with exp publish) by using a machine build (set machine: true) in config.yml… and (for my project) installing yarn as part of the build. I’ve left these changes only on the deploy branch.

version: 2
    # Allow increase of inotify limit to support watchman for exp publish.
    # This should only be on the deploy branch.
    # See
    machine: true
      - run: |
          curl -sS | sudo apt-key add -
          echo "deb stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
          sudo apt-get update && sudo apt-get install yarn
      - run: yarn install

Good luck. It’s an unfortunate limitation in the environment for docker in CircleCI 2.0. Hope they fix it soon.

Does it still work for you?

I get:

sudo sysctl fs.inotify.max_user_watches=524288

sysctl: permission denied on key 'fs.inotify.max_user_watches'