Shell/Bash: how to install composer macos Example


Shell/Bash Example: This is the "how to install composer macos" Example. compiled from many sources on the internet by

how to install composer macos

Open a terminal and navigate to your user directory, ie cd /User//
Run this command shown below to download Composer. This will create a Phar (PHP Archive) file called

curl -sS | php

Now we move 
composer.phar file to a directory
sudo mv composer.phar /usr/local/bin/

We want to run Composer with having to be root al the time, so we need to change the permissions:
sudo chmod 755 /usr/local/bin/composer.phar
Next, we need to let Bash know where to execute Composer: 
nano ~/.bash_profile

Add this line below to bash_profile and save
alias composer="php /usr/local/bin/composer.phar"
and then run this command:
source ~/.bash_profile
Finally, run: 
composer -v

install composer mac

curl -sS | php
php composer.phar install
mv composer.phar /usr/local/bin/composer
open -e  ~/.zshrc
// or open -e  ~/.bash_profile
alias composer="php /usr/local/bin/composer"

upgrading composer globally on windows

php composer.phar self-update

composer mac

php composer-setup.php --install-dir=bin --filename=composer

* Summary: This "how to install composer macos" Shell/Bash Example is compiled from the internet. If you have any questions, please leave a comment. Thank you!