Getting a warning when trying to install composer on mac
<p>I tried today to install the composer on my mac from terminal. I used this command to download and install the composer inside my users folder </p>

<blockquote>
  <p>curl -sS <a href="https://getcomposer.org/installer" rel="nofollow">https://getcomposer.org/installer</a> | php</p>
</blockquote>

<p>but when I press the enter I've got the following warning. </p>

<blockquote>
  <p>All settings correct for using Composer PHP Warning: 
  file_put_contents(/Users/test/.composer/keys.dev.pub): failed to open
  stream: Permission denied in - on line 468</p>
  
  <p>Warning: file_put_contents(/Users/test/.composer/keys.dev.pub): failed
  to open stream: Permission denied in - on line 468 PHP Warning: 
  file_put_contents(/Users/test/.composer/keys.tags.pub): failed to open
  stream: Permission denied in - on line 485</p>
  
  <p>Warning: file_put_contents(/Users/test/.composer/keys.tags.pub): failed
  to open stream: Permission denied in - on line 485 Downloading
  1.2.0...</p>
  
  <p>Composer successfully installed to: /Users/test/composer.phar Use it:
  php composer.phar</p>
</blockquote>

<p>Because the warning has to do with permissions I deleted the composer.phar that has been created and I executed again the same command using composer, but still getting the same warning. How I can fix this warning?</p>

<p>UPDATE
I did </p>

<blockquote>
  <p>curl -sS <a href="https://getcomposer.org/installer" rel="nofollow">https://getcomposer.org/installer</a> | sudo php</p>
</blockquote>

<p>and it worked, but I want to know why. Thanks</p>