MacOS Install Composer globally

Download and Install Composer

First you must download the composer using the following curl command in your terminal:

curl -sS https://getcomposer.org/installer | php

After running that command, there will be a file composer.phar in the current directory. You could use that command:

php composer.phar install

In order to make composer available globally, allowing you to type composer install anywhere, you have to move the recently downloaded composer.phar to local user’s bin folder:

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

Add alias to composer

If you using bash. (Default shell on Mac OS <10.14, 2002–2019)

Open your ~/.bash_profile

nano  ~/.bash_profile

Add an alias to point at the composer.phar you moved into /usr/local/bin/*
Add the following line. It will create an alias of composer that can be used globally.

alias composer="php /usr/local/bin/composer"

If you using zsh. (Default shell on Mac OS 10.15+, 2019-Present)

Open your ~/.zshrc

nano  ~/.zshrc

Add an alias to point at the composer.phar you moved into /usr/local/bin/*
Add the following line. It will create an alias of composer that can be used globally.

Use composer globally

After restarting your terminal you will be able to access composer.

composer install

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Android fundamentals 10.1 Part B: Deleting data from a Room database

SUDOKU SOLVER — WITH SOURCE CODE — FUN PROJECT — EASIEST WAY

GSoC: The beginning (1/?)

Point & Click to Move in Unity

Install tensorflow-gpu and use it using Kernel in Jupyter

[Leetcode] Swap Nodes in Pairs

AWS Elastic Beanstalk rotated logs into a separate S3 bucket using AWS Lambda

[Deploy] SOP

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
PanosDotK

PanosDotK

More from Medium

ITerm 2 & ZSH script for Git Branch

Setting up docker in macOS

Definite guide to setting up Sourcetree and GitHub on Mac (M1)

Mac Terminal(shell)