ikappas / vscode-phpcs

PHP CodeSniffer for Visual Studio Code
MIT License
128 stars 56 forks source link

Can't locate phpcs on macOS Sierra #41

Closed AlDante closed 7 years ago

AlDante commented 7 years ago

Although this has been closed twice, the problem seems to persist. I have a fresh install of VSCode and I have installed phpcs to /opt/local/bin, which is in my path. Calling phpcs from the command line works fine.

Nevertheless I still get the message:

phpcs: Unable to locate phpcs. Please add phpcs to your global path or use composer depency manager to install it in your project locally.

Moving phpcs to /usr/local/bin (also in my path) does not help.

Where does the plugin look for phpcs?

And thanks for your work on this Ioannis, phpcs is awesome and having it as a VSCode plugin would be brilliant.

ikappas commented 7 years ago

Hi AlDante,

The plugin iterates over all the paths defined in your path variable and looks for phpcs executable.

I have phpcs.phar manually installed in /usr/local/bin and a symlink under the same path for phpcs -> /usr/local/bin/phpcs.phar that works under macOS 10.12.4.

Please make sure that phpcs.phar is executable using:

/usr/local/bin$ chmod +x phpcs.phar

Also, my user account has rwx permissions on the executable.

I hope this helps.

AlDante commented 7 years ago

Hi Ioannis,

thanks for the help. I added the link and checked the executability, but unfortunately I still have the same problem.

ll /usr/local/bin/phpcs.phar lrwxr-xr-x 1 root wheel 25B Apr 9 14:28 /usr/local/bin/phpcs.phar -> /opt/local/bin/phpcs.phar

ll /opt/local/bin/phpcs.phar -rwxr-xr-x 1 david staff 511K Apr 8 08:09 /opt/local/bin/phpcs.phar

Davids-MBP:bin david$ echo $PATH /opt/local/bin:/opt/local/sbin:/usr/local/autoconf/bin:/usr/local/openssl/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/david/myscripts

My account is david.

I am also using 10.12.4 Sierra.

What did you mean by “a symlink under the same path for phpcs -> /usr/local/bin/phpcs.phar”?

Kind regards and ευχαριστώ

David

On 8. Apr 2017, at 14:01, Ioannis Kappas notifications@github.com<mailto:notifications@github.com> wrote:

Hi AlDante,

The plugin iterates over all the paths defined in your path variable and looks for phpcs executable.

I have phpcs.phar manually installed in /usr/local/bin and a symlink under the same path for phpcs -> /usr/local/bin/phpcs.phar that works under macOS 10.12.4.

Please make sure that phpcs.phar is executable using:

/usr/local/bin$ chmod +x phpcs.phar

Also, my user account has rwx permissions on the executable.

I hope this helps.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/ikappas/vscode-phpcs/issues/41#issuecomment-292713628, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ADRZOITAEDyQjCJwa8OA2QK4Lw2JLH0Dks5rt3ckgaJpZM4M3n2A.

ikappas commented 7 years ago

@AlDante

You seem to have a symlink of phpcs.phar on /usr/local/bin pointing to /opt/local/bin with the extension phar.

Can you try making a symlink without the extension and see if this helps

$ ln -s /opt/local/bin/phpcs.phar /usr/local/bin/phpcs
AlDante commented 7 years ago

Hi Ioannis,

thanks, that does the trick. Sorry for the distraction.

Kind regards, David

On 10. Apr 2017, at 12:10, Ioannis Kappas notifications@github.com<mailto:notifications@github.com> wrote:

ln -s /opt/local/bin/phpcs.phar /usr/local/bin/phpcs

ikappas commented 7 years ago

@AlDante Good to hear that!

I hope this helps others experiencing the same issue! Closing this