MacOS Composer Installation

MacOS Composer Installation

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you. Below are the steps on MacOS Composer Installation.

  1. Open your terminal and type this command:
curl -sS https://getcomposer.org/installer | php
  1. Move the composer.phar file into bin directory to make it global and can be accessible anywhere.
sudo mv composer.phar /usr/local/bin/
  1. Change the composer permission to run as root all the time
sudo chmod 755 /usr/local/bin/composer.phar
  1. Run the nano ~/.bash_profile command and add the line below to link the executable file when running the composer command
alias composer="php /usr/local/bin/composer.phar"
  1. Lastly, run the command below.
composer --version

I created a short video if you want to see it visually regarding the MacOS Composer Installation.

If you have any queries, please do comment below or contact me via email.

Leave a Reply