Install PHPCS and PHPMD on OSX Yosemite

If you are looking to install PHP CodeSniffer (PHPCS) and PHP Mess Detector (PHPMD) on OSX Yosemite, there are a few things you need to do, but they are really simple.

First, make sure that you have Git installed, if not, head here and grab the latest package for Max OSX.

Next open up your terminal and run the following.

# Make a bin directory in your home folder, this will stop things being overwritten
mkdir ~/bin
cd ~/bin

# Get the latest versions from git, make sure you have git installed
git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs
git clone git://github.com/phpmd/phpmd.git

# install composer into your bin folder
curl -s http://getcomposer.org/installer | php

# add composer, phpcs and phpmd to your path
sudo ln -s ~/bin/phpcs/scripts/phpcs /usr/local/bin/phpcs
sudo ln -s ~/bin/phpmd/src/bin/phpmd /usr/local/bin/phpmd
sudo ln -s ~/bin/composer.phar /usr/local/bin/composer

# configure phpmd
cd ~/bin/phpmd
composer install

There you have it, you have now installed PHPCS and PHPMD on OSX Yosemite.

Share

2 thoughts on “Install PHPCS and PHPMD on OSX Yosemite

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.