I've followed the instructions provided on the wp-cli.org site but I can't seem to get the wp command to run for all users.

I copied the file to /usr/local/bin and renamed it to wp per the instructions. And when I'm logged in as root I can run wp from anywhere and it works (although it gives me the "are you sure you want to run this as root?" warning).

I was under the impression that moving an executable to /usr/local/bin would make that executable available to all users. However, when I switch to another user, I get a "command not found" error.

How can I install wp-cli for all users? I want to make sure every user with SSH access can run wp-cli.

Thanks in advance!

  • You need to add /usr/local/bin to the PATH globally.
    – chicks
    Mar 20, 2017 at 2:17
  • This is actually in the global user PATH. When I login as a non-root user and run echo $PATH this is what I get: /usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/opt/cpanel/composer/bin:/home/iansvoboda/.local/bin:/home/iansvoboda/bin The problem is that the binary wp isn't present in /usr/local/bin for non-root users. Also, I'm running WHM, so I suppose there could be some security restriction or something on 3rd party binaries? Mar 20, 2017 at 2:38
  • What do you get if you run /usr/local/bin/wp?
    – chicks
    Mar 20, 2017 at 2:41
  • -bash: /usr/local/bin/wp: No such file or directory This is what I would expect, since as I said the binary doesn't appear to be present in that directory for a non-root user. I have no idea why though. Mar 20, 2017 at 2:44
  • I would expect /usr/local/bin/ to be the same for everybody. But that command works for you as root?
    – chicks
    Mar 20, 2017 at 2:46

2 Answers 2


I determined that the issue was related to cageFS.


If the server environment is using CloudLinux with cageFS enabled, cageFS definitions must be updated to allow the wp command to be accessible to non-root users

I found these instructions here to do this: https://docs.redy.host/knowledge-base/install-wp-cli-cpanel-cagefs/


Generic solution is to install WP-CLI as the root user, typically putting it in /usr/local/bin:

Step 1

curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar

Step 2

chmod +x wp-cli.phar

Step 3

sudo mv wp-cli.phar /usr/local/bin/wp

Now add /usr/local/bin to the $PATH of each user which can either be done locally for each user by adding PATH=$PATH:/usr/local/bin into the ~/.bashrc or ~/.bash_profile or, even cooler, but adding that path globally from the root user by putting the PATH export in a bash script within /etc/profile.d/. For example:

Step 4

# /etc/profile.d/add_user_local_bin.sh

Now all the users can use wp-cli commands. Cool.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .