You can download and install composer using instructions here: https://getcomposer.org/download/.
Alternatively you can install composer using Homebrew. Homebrew makes it easy to install software and manage updates. You can find instructions on how to install Homebrew here: https://suesdesign.co.uk/install-sass-node-js-and-grunt-on-mac-os-x/
To install Composer using Homebrew, open up the terminal and type the following command:
brew tap homebrew/homebrew-php
Then type this command:
brew install composer
Now check Composer is installed:
It should give you the version number.
Now open up ~/.bash_profile. You can do this with any text editor.
To use Vim type:
The file will open up.
Now press i (for insert mode) and copy and paste this:
Press escape then hold down shift and press z twice to save and quit.
To get it to work, type:
Or open a new terminal window.
You can then use Composer to install Drush:
Into the terminal type:
composer global require drush/drush
To check if Drush is installed, type:
That is it! Now you are ready to use Composer and Drush with Drupal.
If you want to install Drupal using the Composer template for Drupal projects you can follow the instructions here: https://github.com/drupal-composer/drupal-project/blob/8.x/README.md