How to fix this Atom linter error: “Make sure`phpmd` is installed and on your PATH”

atom phpmd linter error

The linter-phpmd plugin for Atom is popular with PHP and WordPress developers, but it relies on having phpmd installed and available on your PATH.  Without it, you might see an error:

If you’ve seen this error in your Atom Developer Tools, the fix is quite simple.  You just need to:

  1. Install phpmd – we’ll use Composer for this.
  2. Add it to your path – this makes it available anywhere on your command line.

Is Composer already installed globally?

If so, consider running composer self-update  to be sure you’re on the latest version.

If not, jump over to getcomposer.org to install it globally on your local system.  Then come back and continue with the steps in this post.

You can check if it’s installed by attempting to get the version.  It should return something like “Composer version 1.4.2 2017-05-17 08:17:52”.

Install phpmd

Installing phpmd globally is required to ensure it is available for Atom to use.  Start by running the following command:

You can now run phpmd using the full path to the installed binary:

That’s helpful, but let’s make sure the command is available everywhere without the full path.

Add phpmd to your PATH

You could add just phpmd to your path, but I find it’s much easier to add all of your globally-installed Composer binaries to your path, so that they are always available to you.  (Hey, they’re supposed to be global, right?!)

To do that, use your favorite terminal editor to edit your ~/.bash_profile (or ~/.bashrc) file.

You’ll need to add the following lines somewhere in the file:

Then, be sure to reload your environment variables in your terminal by running:

Verify it works!

Try to run the raw phpmd command to get the currently installed version:

Those pesky Atom phpmd linter errors should now have melted away 🙂

Author: Grant Norwood

Designer of things you click. Vegetable rights activist. Volunteer with tiny humans. Austin-ish, Texas.

People describe me as a rad web developer, product manager, solutions architect, public speaker, volunteer, and non-profit board member.

Did you know you can leave a comment?