your programing

OSX -bash : composer : 명령을 찾을 수 없습니다.

lovepro 2020. 9. 25. 23:23
반응형

OSX -bash : composer : 명령을 찾을 수 없습니다.


"작곡가"를 입력하면 위의 오류 메시지가 나타납니다.

나는 내 맥북에서 :

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Composer를 전역으로 설치합니다.

/ local / bin / composer 디렉토리를 수동으로 만들어야했는데 이로 인해 오류가 발생했을 수 있습니까?

php composer.phar

.phar 파일이있는 내 코드 디렉토리에서 작동합니다.

문제를 해결하고 전 세계적으로 composer를 실행하려면 어떻게해야합니까?

내 ~ / .profile

export PS1="\W: "
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx

~ : echo $ PATH

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/local/bin
~: 

경로 /usr/local/bin/composer가 PATH에 없으며 해당 폴더의 실행 파일을 찾을 수 없습니다.

폴더를 삭제 한 /usr/local/bin/composer다음 실행

$ mv composer.phar /usr/local/bin/composer

이 이동 composer.phar/usr/local/bin/로 및 이름 변경을 composer(아직 실행 파일이 아닌 폴더입니다).

그런 다음 다음과 같이 사용하십시오.

$ composer ...

글쎄, 나는 많은 것을 시도했지만 아무것도 작동하지 않는 것 같았습니다. 그러나 다음 프로세스가 올바르게 수행되었으므로 이제 composer터미널에서 명령을 사용할 수 있습니다 . Mac OS 10.12.1에 있습니다.

$ curl -sS https://getcomposer.org/installer | php
$ chmod +x composer.phar
$ mv composer.phar /usr/local/bin/composer
$ composer

composer.pharAmazon Linux에서 다음 명령을 사용하여 '/ usr / local / bin / composer'로 이동 한 후에도 동일한 문제가 발생 합니다.

mv composer.phar /usr/local/bin/composer

다음 명령을 사용하여 작성기 파일의 별칭을 만들었습니다. 이제 전 세계적으로 실행됩니다.

alias composer='/usr/local/bin/composer'

이것이 OS-X에서 작동하는지 여부는 모르겠습니다. 하지만이 문제로 검색하면이 링크가 나타납니다. 그래서 저는 여기에 게시하고 있습니다. 이것이 누군가를 도울 수 있기를 바랍니다.


composer 웹 사이트의 지침을 통해 설치 한 후 Mac OSX에서 테스트했습니다.

sudo mv composer.phar /usr/local/bin/composer

이것은 Ubuntu에서 작동합니다.

alias composer='/usr/local/bin/composer/composer.phar'

OS X 10.11 El Capitan에 Composer 전역 설치

이 명령은 OS X 10.11에서 작동하지 않습니다.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer 

대신 사용자의 / usr / local / bin 경로에 쓰겠습니다.

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Now we can access the composer command globally, just like before.


On Mac OS X, for anyone having:

-bash: /usr/local/bin/composer: Permission denied

problem, while trying to move downloaded composer.phar using:

mv composer.phar /usr/local/bin/composer

this is the cause:

System Integrity Protection

and this is the solution:

  1. Reboot in recovery mode: restart you mac and hold down cmd+R.
  2. Open the terminal once recovery mode has started via Utilities>Terminal via the bar at the top.
  3. Type in csrutil disable and hit enter. You should see a msg returned saying that:

    the System Integrity Protection is off.

  4. Restart the computer as normal and then go set up composer. I had to put it in /usr/bin and NOT /usr/local/bin because for some reason it just didn't work there.
  5. Go back to recovery mode and enable System Integrity Protector by typing csrutil enable
  6. Come back in normal boot up and check that composer works. It did for me.

The above 6 steps are copied from here, so all the credit belongs to the user Vasheer there.


this wasted me a day or two. like why dont anybody say on tutorials that the command composer is not to be used without actually linking and stuff... I mean everyone is writing composer command like its the next step when we are not all 5 years experienced users to know these details.

cp composer.phar /usr/local/bin/composer

did it for me on ubuntu after getting stuck for 2 days

참고URL : https://stackoverflow.com/questions/25018894/osx-bash-composer-command-not-found

반응형