PHP Composer — Невозможно установить composer на macOS Sierra
Я пытаюсь установить composer с помощью команды, представленной на сайте документации getcomposer.org/download:
Но я получаю сообщение об ошибке:
Я также пытаюсь установить это глобально, но я не могу выйти из этого сообщения. Пожалуйста, помогите D:
Решение
У меня были те же проблемы, но это то, что я сделал:
(проблема была вызвана из-за https protocol )
Другие решения
У меня такая же проблема-
вот верный путь
чистый каталог> Terminal> mkdir composer
sudo mv composer.phar /usr/local/bin/
alias composer=»php /usr/local/bin/composer.phar»
У меня были те же проблемы, но это то, что я сделал:
Это работает для меня следующим образом:
на моем терминале, который сделал композитор для установки на моем компьютере.
А затем я переместил Composer в свою папку bin, чтобы запустить ее глобально:
Инструкции в Composer официальная страница иногда сбивает с толку
или не работает на macOS Sierra.
Но установка по-прежнему проста, как и раньше. Просто запустите две команды в вашем терминале.
Пожалуйста, не используйте ничего из этого. Я не говорю, что это неправильно.
Пожалуйста, перейдите по ссылке https://getcomposer.org/download/ для установки последней версии композитора.
И сравнивая с неправильным SHA384 hash_file (вроде e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae ), так что не получится.
У меня были также те же проблемы, чтобы установить composer после чистой установки macOS Sierra. Мое решение заставить его работать:
permission denied for composer in /usr/local/bin/
The permissions in /usr/local/bin/ (I changed them to 777, but it did not help):
In my home directory I did this:
I also tried sudo composer self-update but it did not work as well and is possibly not the right way. (?). What else could I try to make this work?
11 Answers 11
On Ubuntu server >= 16.04
/.cache/composer should be cd
/.composer/cache depend on which way composer was installed. On my installations, locations are
but not by running php composer-setup.php
make composer.phar executable with following command before moving it to /usr/local/bin/composer or after moving
sudo chmod 755 composer.phar
composer-setup.php will make this change for us by default
You should check the permissions of the directory /usr/local/bin/, not just the file within. The process has to write both, the file and into the directory which both must be granted.
Apart from that, a general hint: do not always set everything to 777. There is no reason for that and it makes your system vulnerable.
According to the line you posted in the last comment the directory is currently writeable only for the root user himself. That would explain the error you get. You should not make your own user account the owner, Linux systems are multi user environments. Instead think about one of these approaches:
The last option is the typically chosen and preferred one. It leaves permissions as they are (conservative) and only uses raised privileges for system maintenance jobs like installation and upgrade.
How to fix Error: mkdir(): Permission denied when running composer
I have a ec2 image and get the following error when trying to create a new laravel project.
[ErrorException] mkdir(): Permission denied
Here is the command:
I can write to the folder with my ec2-user username but do I need to add permission for composer to write?
10 Answers 10
For security reasons, lets keep root as the owner and just allow ourselves to read, write, and execute within the area which we will be working in.
Change group ownership
Add priviledges to our group
For the grand finale, go ahead and create your new laravel project
Congratulations, We’re done. 🙂
I still want root to be the owner of the files for security reason.
I am working in a localhost so there shouldn’t be any other (guest)users writing on my files.
In order to achieve this we will need to edit the group ownership and add the proper permissions. We will leave the others as is and only allow them to read and execute the files.
So lets get started:
I like being in the directory that I am making changes to in order to avoid mistakes so first we will need to enter the the directory which we will be working in.
We will need to change the group ownership of the directories which we will be working in. Starting from the directory which we are in and all the future directories and files we will create underneath this directory. So basically any children directories from now on will be own by our group.
. = This just means ‘here, in this directory’.
chmod = command to change modifications, in this case, privileges.
-Rv = Recursive & Verbose
g = this states who will receive the modifications. In our case g-group Other options are u-user and o-other.
r = symbolizes read
w = symbolizes write
If you get this: drwxrw-r-x
You are missing the executable( x ) privilege for the group. The first x is for the user and last x is for others. There should be middle x for the group.
Run the following command and you should be all set to go:

