OSX -bash: composer: command not found

前端 未结 10 1027
我寻月下人不归
我寻月下人不归 2020-12-22 18:52

If i type \"composer\" i get the above error message.

I did on my macbook:

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


        
10条回答
  •  我在风中等你
    2020-12-22 19:18

    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.

提交回复
热议问题