I followed the documentation on https://getcomposer.org/doc/00-intro.md#globally to install composer globally on arch linux. When I do composer self-update, I g
composer self-update
Use sudo command for any command which writes to root files of folder. It worked for me.
use sudo "your command"