If this post helped you, please consider turning off your adblocker
or giving us all of your money.

Introduction

Composer is a PHP dependency management tool. It is not necessarily a package manager in the traditional sense, like NPM or Yum. It does handle packages but it does it on a per-project basis.

This can be very useful when setting up a project or adding dependencies to a project.

Throughout my programming career I have Google’d How to install composer globally and always search for the way to do it in one terminal command. Then the next time I need it that site is no longer there. So this post is for me so I no longer have to look for it!

OS X 10.11


1
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer


Type composer into the terminal and you should see this:

Successfully installed composer

OS X 10.10


1
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/bin --filename=composer


Now you should be able to use composer globally by typing composer in the terminal.