Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

kfirba's avatar
Level 50

composer create-project laravel/laravel returns permission denied

Hello!

Today I got my new MBP. I was going through the process of installing all of my applications and got to the point where I try to create a new laravel 5 project.

When I typed:

composer create-project laravel/laravel laravel5 dev-develop

I was returned with the error:

[ErrorException] mkdir(): Permission denied

Any idea how do I fix this?

0 likes
9 replies
kfirba's avatar
kfirba
OP
Best Answer
Level 50

OK. I had to open a folder which will then belong to me and then run the command:

sudo chmod 777 code

After doing that I can use composer as intended inside the code directory.

2 likes
alenabdula's avatar

open a folder which will then belong to me ... sudo chmod 777 code

You changed the permissions of this folder not ownership. Error is most likely Composer permissions issue. It's being denied write permissions. How did you install Composer?

1 like
bashy's avatar

This is not the way to go about it. Neither is it good to show that as a solution, it's a bad security risk and practice.

1 like
dhorowitz1's avatar

alenabdula, How do we correct the install of Composer so it is not denied write permissions?

dhorowitz1's avatar

@bashy Sorry, I might be a little slow at this, I'm pretty new. When you say 'which composer', what does that mean?

bashy's avatar

That's what you'd type exactly. If you do man which (man = manual).

man which

NAME
     which -- locate a program file in the user's path

Running it within ` just executes that command then outputs the result so it's like an automatic way of getting a dynamic path. Can be different on other people's computer but this one command will work for all (so to speak).

Please or to participate in this conversation.