How to install Composer on MacOS

How to install Composer on MacOS
How to install Composer on MacOS

Composer is an application level package manager for the PHP programming language. It provides a standard format for dependencies management of PHP software and required libraries. It was developed by Nilsadermann and JoddiBoganiano. It was released on March 1, 2012. In this tutorial, we will learn the installation process of Composer on MacOS.

Installation of composer includes following steps.

  • Download
  • Run Composer-setup
  • Move Composer.phar to /usr/local/bin/composer  
  • Run Composer

1.Run the following command to download Composer setup on MacOS.

$ sudo php -r "copy('','composer-setup.php');" 

2.A file named as composer-setup.php needs to be executed to get started with the installation of composer on our MacOS. It installs the Composer in the current directory which is our home directory. A file named as composer.phar will be created which needs to be moved to /usr/local/bin/composer to run composer globally.

$ sudo php composer-setup.php

3.Composer.phar needs to be moved to /usr/local/bin/composer in order to run composer globally on the terminal. For this purpose, following command will be executed.

$ sudo mv composer.phar /usr/local/bin/composer  

4.Now composer is installed on our system, to get it run on the system, just type composer on the terminal. The window will appear like following.

$ composer
composer is installed on our system
Composer is installed on our system


您的电子邮箱地址不会被公开。 必填项已用 * 标注