Skip to content

Instantly share code, notes, and snippets.

@dajoho
Created October 4, 2012 11:39
Show Gist options
  • Save dajoho/3833091 to your computer and use it in GitHub Desktop.
Save dajoho/3833091 to your computer and use it in GitHub Desktop.
Install PHPCS OSX
sudo cp /private/etc/php.ini.default /private/etc/php.ini;
sudo php /usr/lib/php/install-pear-nozlib.phar;
pear config-set php_ini /private/etc/php.ini;
pecl config-set php_ini /private/etc/php.ini;
sudo pear upgrade-all;
sudo pear install PHP_CodeSniffer;
----
nano /private/etc/php.ini;
include_path Zeile einkommentieren & umändern in:
include_path = ".:/php/includes:/usr/lib/php/pear/"
----
cd ~/Sites/myproject;
phpcs index.php;
@paunin
Copy link

paunin commented Jul 26, 2014

In my case PEAR is under /usr/share/pear/
So in my php.ini i have include_path = ".:/php/includes:/usr/share/pear"

@dsoprea
Copy link

dsoprea commented Sep 25, 2014

On recent versions of OS X, /etc is symlinked into /private/etc.

@chadfurman
Copy link

I was able to just run

sudo pear upgrade-all and sudo pear install PHP_CodeSniffer

and now it "just works"

localhost $ phpcs --version
PHP_CodeSniffer version 1.5.5 (stable) by Squiz (http://www.squiz.net)

@rmondragon
Copy link

Worked like a charm in MacBook Pro - Yosemite, thank you. R6.
I will add to change permissions over php.ini to be able to write.

@dv336699
Copy link

dv336699 commented Oct 9, 2015

@shadelotus command worked like a charm in El Capitan 👍

@Oli-Chowdhury
Copy link

Oli-Chowdhury commented Jun 20, 2016

Worked like a charm in Yosemite

@ajmorenodelarosa
Copy link

Awesome!

@venatiodecorus
Copy link

I'm on Sierra and I had to manually symlink phpcs to the phpcs bin in my Homebrew cellar (even though I installed PHP_CodeSniffer via PEAR, my PHP install was through Homebrew)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment