Can't move composer

独自空忆成欢 提交于 2019-12-25 02:49:11

问题


When I install composer on my mac with:

curl -sS https://getcomposer.org/installer | php

And then try to move it like this:

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

it's telling me:

rename composer.phar to /usr/local/bin/composer: No such file or directory

When I look to my path:

echo $PATH

It's telling me:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

That can't be right I guess, I'm not very familiair with composer what should I do?

Thankyou


回答1:


Try with below command to install composer globally.

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

Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create the directory manually before proceeding: mkdir -p /usr/local/bin.




回答2:


If you are running macOS Sierra Version, there might not be a /usr/local/bin folder so you will have to create it. Follow these steps in the terminal:

Step 1: cd ~

Step 2: sudo mkdir -p /usr/local/bin

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


来源:https://stackoverflow.com/questions/33868004/cant-move-composer

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!