How To Install Composer in MacOS Easily?

The PHP composer helps you to manage, install, and declare dependencies of PHP projects. The composer project has dramatically changed the ecosystem of PHP by maintaining and distributing PHP packages as application components.

We have provided a complete step-by-step guide to installing PHP composer on your macOS.

1. Prerequisites

  • Shell access to a running macOS
  • PHP 5.3 or higher

2. Install Composer on macOS

How To Install Composer in MacOS Easily?

Download and Install Composer from by using the following command

curl -sS | php 

To make this file available anywhere in the system copy composer.phar file under the bin directory. Change its permissions to executable, also we have changed its name from composer.phar to the composer for easy use.

mkdir -p /usr/local/bin  mv composer.phar /usr/local/bin/composer  chmod +x /usr/local/bin/composer

Now run the composer command, this command will provide all the details about the composer and will display all the options under composer.

How To upgrade PHP Composer?

PHP composer provides a command for self-updating itself. Use the command below to upgrade your composer file.

sudo composer self-update 

How To Uninstall Composer from macOS?

To uninstall Composer from macOS use the following command:

sudo rm /usr/local/bin/composer

Leave a Comment

14 − 3 =