Skip to content

Watchman Docs Only Specifies Default Paths for Linux #1291

@pa-0

Description

@pa-0

Reading through the watchman docs, it seems that they were written before watchman was ported to Windows?

Example 1:

Watchman looks for configuration files in two places:

  • The global configuration file /etc/watchman.json
  • The root specific configuration file .watchmanconfig

Example 2:

Quick note on default locations

Watchman will prefer to resolve your user name from the $USER environmental variable, or $LOGNAME if $USER was not set. If neither are set watchman will look it up from the system using getpwuid(getuid()). When we refer to <USER> in this documentation we mean the result of this resolution.

In some cases Watchman will need to create files in a temporary location. Watchman will resolve this temporary location by looking at the $TMPDIR environmental variable, or $TMP if $TMPDIR was not set. If neither are set watchman will use /tmp. When we refer to <TMPDIR> in this documentation we mean the result of this resolution.

Watchman tracks its persistent state in a location that we refer to as the <STATEDIR> in this documentation.

Since 3.1.

The STATEDIR defaulted to <PREFIX>/var/run/watchman. You can change this default when you build watchman by using the configure option --enable-statedir.

Earlier versions of Watchman didn't have a default statedir and would instead use the <TMPDIR> for this state. We switched away from that because some environments randomize the <TMPDIR> location and this made it difficult for clients to locate the Watchman service.

Since 3.8.

The STATEDIR defaults to <PREFIX>/var/run/watchman/<USER>-state. You can change this default when you build watchman by using the configure option --enable-statedir; the configure option replaces the <PREFIX>/var/run/watchman portion of this string. If you specify --disable-statedir then that portion of the string will be computed from the <TMPDIR> location.

Watchman will create the <USER>-state portion if it does not exist, and will perform some permission and ownership checks to reduce the risk of untrusted users placing files in this location. If those checks are not satisfied, watchman will refuse to start.

Locating the service

 -U, --sockname=PATH   Specify alternate sockname

The default location for sockname will be <STATEDIR>/<USER>. Older versions of Watchman would default to <TMPDIR>/.watchman.<USER>, depending on how it was configured.

If you are building a client to access the service programmatically, we recommend that you invoke watchman get-sockname to discover the path that the client and server would use. This has the side effect of spawning the service for you if it isn't already running.

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