Installing Watchman on Windows (Win10) is straightforward, but there are a few key points to note. Below are the detailed steps and recommendations:
Step 1: Install Chocolatey
Watchman can be installed via Chocolatey, a Windows package manager. First, ensure Chocolatey is already installed on your system. If not, follow these steps:
- Open a Command Prompt with administrator privileges (right-click the Start button and select 'Command Prompt (Admin)').
- Execute the following command to install Chocolatey:
shellSet-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
This command downloads and runs the Chocolatey installation script.
Step 2: Install Watchman using Chocolatey
Once Chocolatey is installed, proceed to install Watchman. Execute the following command in an administrator Command Prompt:
shellchoco install watchman
This command automatically locates the latest version of Watchman from the Chocolatey repository and installs it.
Step 3: Verify Installation
After installation, confirm Watchman is correctly installed and accessible. Execute the following command in the Command Prompt:
shellwatchman --version
If successful, this command displays the Watchman version.
Additional Notes
- Administrator privileges: Administrator privileges are required during installation to ensure proper system-wide installation.
- Network connection: A stable internet connection is necessary, as Chocolatey downloads Watchman from the internet.
Example
In my previous project, we used Watchman to monitor file changes and automatically trigger test and build tasks. After installing Watchman, we created a simple watchman script to monitor project file modifications, significantly enhancing development efficiency and code quality. For instance, whenever a file is modified, Watchman automatically initiates our automated test suite to ensure no existing functionality is broken.