This can happen if you have installed a previous composer installation that is not completely removed, or if you run the installer with a user other than the owner of the .composer
folder.
You can rename the old folder (have a backup), and then try again:
mv ~/.composer ~/.composer.old
This is less dangerous than doing something unknown with sudo.
source share