I'm testing CiviCRM 4.7 in a WordPress 4.4.2 installation. I'm running this on a local server with Mac OSX 10.11.2 using MAMP Pro.

I'm trying to configure cron using the wp-cli method. I've installed, renamed and moved wp-cli and running wp --info in /Applications/MAMP/bin gives

PHP binary: /usr/bin/php PHP version: 5.5.30 php.ini used:
WP-CLI root dir: phar://wp-cli.phar WP-CLI global config:
WP-CLI project config:
WP-CLI version: 0.22.0 Phils-MacBook-Air:bin phillip$

wp help shows the WordPress commands

I'm now trying to implement

/path/to/wp --user=<cron> --url=<http://example.com> --path=</path/to/wp> civicrm api job.execute auth=0

In my case I'm trying

/users/phillip/Sites/thetestsite.dev --user=<philnicholl> --url=<http://thetestsite.dev:8888> --path=</users/phillip/Sites/thetestsite.dev> civicrm api job.execute auth=0

but I get

-bash: philnicholl: No such file or directory

(philnicholl is my WordPress administrator username)

I know I'm missing something obvious.

I'm have experience with WordPress and Mamp Pro but am new to both CLI and CIVICRM. Any help would be much appreciated.

Thank you.

  • Just checking - does your command literally include the '<', '>' around the user, url and path values? If so, remove them - they are meant as placeholders in the example line. Bash interprets them as stdin, stdout redirection.
    – Aidan
    Feb 14, 2016 at 7:25
  • Thank you. Running /users/phillip/Sites/thetestsite.dev --user=philnicholl --url=http://thetestsite.dev:8888 --path=/users/phillip/Sites/thetestsite.dev civicrm api job.execute auth=0 I now get -bash: /Users/phillip/Sites/thetestsite.dev: is a directory I'm trying to follow these instructions: [wiki.civicrm.org/confluence/display/CRMDOC/… Does the /path/to/wp in the instructions refer to the path to the root folder of the local site or to wp-cli.phar renamed as wp now in /usr/bin/ ? Feb 14, 2016 at 8:09

1 Answer 1


Here's an example wp-cli command I use that works:

/home/ubuntu/wp-cli/wp-cli --require=/home/ubuntu/wp-cli/civicrm.php --path=/var/www/wordpress civicrm api job.execute > /dev/null

I hope that helps!

UPDATE: I see your problem! "/path/to/wp" means, "path to wp-cli, including wp-cli". I completely looked past that part at the beginning, since that's not generally where the problems are found.

Usually, "wp-cli" is aliased to "wp" so it can automatically include the CiviCRM extension - but with cron, I usually just use the require directly.

So log into your computer and type which wp-cli. Let's say it returns /usr/bin/local/wp-cli. Replace ONLY the first path to WP with that, so it looks like:

To forestall your next question about why it doesn't work - the is a placeholder, and the angle brackets should NOT be included in the actual statement. Angle brackets are a common way in documentation of command-line programs to say, "insert your value here". So instead of <philnicoll>, just write philnicoll.

You should be left with something like:

/usr/bin/local/wp-cli --user=philnicholl --url=http://thetestsite.dev:8888 --path=/users/phillip/Sites/thetestsite.dev civicrm api job.execute auth=0
  • Thank you, though I'm not exactly sure how to change your command to suit my case. Feb 14, 2016 at 8:49
  • @philnicholl I just updated my answer, hope it helps. Feb 14, 2016 at 16:32
  • Thank you, Jon. I'd previously moved and renamed wp-cli as wp and moved it to /usr/bin - running which wp confirms this returning /usr/bin/wp . So I tried running usr/bin/wp --user=philnicholl --url=http://thetestsite.dev:8888 --path=/users/phillip/Sites/thetestsite.dev civicrm api job.execute auth=0 and got Error establishing a database connection which seems like an improvement. Where now? Thank you for your help. Feb 16, 2016 at 14:38
  • The wiki CIVICRM instructions for the wp-cli method do seem rather confusing in that /path/to/wp appears twice in the code but represents two different things and then in the following comments it says 'Replace </path/to/wp civicrm>' Presumably the last placeholder chevron is in the wrong place and should be after wp and not after civicrm. Feb 16, 2016 at 14:47
  • I fixed the database connection problem following instructions here: laurenpittenger.com/… I had to unlock my bash profile using instructions here: stackoverflow.com/questions/15824493/… All good now: Cron running OK. Thanks very much. Feb 16, 2016 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.