how to upgrade my composer code example

Example 1: update composer mac

#Ubuntu-Download Composer and create a Phar (PHP Archive) file
$ curl -s https://getcomposer.org/installer | php

#Move it to bin directory
$ sudo mv composer.phar /usr/local/bin/composer

Example 2: update composer

To update composer command just find location of composer.phar and update as:
 where composer 	#Retrieves you location of your composer.phar
 cd path_to_composer.phar #Move to directory with composer.phar
 php composer.phar self-update	#Update your composer