How to install Composer on MacOS

How to install Composer on MacOS

353

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.

Prerequisites

  1. MacOS
  2. Login as an administrator on terminal
  3. PHP

Installation

Installation of composer includes following steps.

1) Download

Run the following command to download Composer setup on MacOS.

sudo php -r "copy('https://getcomposer.org/installer','composer-setup.php');"

2) Check the installer for verification

Hash file code of Composer setup needs to be verified in order to verify the installer.

3) Run Composer-setup

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/bin/composer to run composer globally.

4) Move Composer.phar to /usr/bin/composer

Composer.phar needs to be moved to /usr/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

5) Run Composer

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

Hence, we have successfully installed and checked composer on our MacOS. Now we can install other dependencies or packages with its help.


Important:

Remember try the composer command in new terminal window.

- Last updated 1 year ago

Be the first to leave a comment.

You must login to leave a comment