I'm following the instructions to install composer (found here). I just ran the line php composer-setup.php
and the terminal returned:
All settings correct for using Composer
Unable to write keys.dev.pub to: /home/ubuntu/.composer
I'm installing into a Ubuntu VM in Vagrant.
It can happen when you have a previous installation of composer not completely removed or if you are running the installer with a user different to the owner of .composer
folder.
You can rename the old folder (to have a backup) and then try again:
mv ~/.composer ~/.composer.old
This is less risky than executing something unknown with sudo.