If you want to keep WP-CLI local and run with php wp-cli.phar, here’s what you do:
1. Download WP-CLI locally
Inside your WordPress project root (where wp-config.php lives):
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
2. Run WP-CLI with PHP
Instead of wp, use:
php wp-cli.phar –info
That should print WP-CLI version + PHP info.
3. Generate the .pot file
Now, run the i18n make-pot command like this:
php wp-cli.phar i18n make-pot . languages/my-plugin.pot –domain=my-plugin –exclude=node_modules,vendor,tests
. → scan current directory
languages/my-plugin.pot → output file
--domain=my-plugin → your plugin/theme text domain