LargeTuna
LargeTuna

Reputation: 2824

Trying to install Symfony2 but keeps requiring sudo

I am trying to install Symfony2, Im on a new mac with MAMP installed. Why is it requiring me to use sudo to do everything from terminal? I am logged in as me and Iam pretty sure I have all the permissions I need.

I have to use sudo for all of these:

 sudo curl -s https://getcomposer.org/installer | php
 php composer.phar create-project symfony/framework-standard-edition /path/to/webroot/Symfony '2.5.*'
 sudo curl -s http://getcomposer.org/installer | php

Here is one of the errors that I keep getting when I dont run from sudo:

 file_put_contents(/Users/myusername/.composer/cache/repo/https---packagist.org/packages.json): failed to open stream: Permission denied

https://packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date

My MAMP & htdocs directory has these permissions:

MAMP: drwxrwxr-x@ 22 myusername  admin  748 Oct  3 19:04 MAMP 
htdocs: drwxrwxrwx   4 myusername  admin   136 Oct  3 21:46 htdocs

This is creating so many permission errors when I try to do anything without using sudo. How can I get around not having to use sudo. Im not a permissions master as I am sure you can gather. Thanks for your help!

Upvotes: 0

Views: 431

Answers (1)

Alexandru Guzinschi
Alexandru Guzinschi

Reputation: 5726

Most likely your .composer directory is owned by root (ls -la ~ to test that).
If that is the case, chown .composer directory (recursively) to your username:

sudo chown -R <myusername>:<myusername> /home/<myusername>/.composer

Do not forget to replace <myusername> with your username.

Upvotes: 1

Related Questions