If you don't have Homebrew
, install it:
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
If you don't have wget
, install it:
$ brew install wget
Download and install composer
$ wget https://raw.githubusercontent.com/composer/getcomposer.org/master/web/installer -O - -q | php --
Move it to access it globally
$ sudo mv composer.phar /usr/local/bin/composer
Echo to your .bash_profile
to be able to call composer
globally if you haven't done so before (cat ~/.bash_profile
to verify)
$ echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bash_profile
Refresh your Terminal window
source ~/.bash_profile
Test your installation with:
$ composer -V
# Expect: Composer version 1.7.2 2018-08-16 16:57:12
- If you are using Oh My Zsh, replace
~/.bash_profile
with~/.bzshrc
for all above commands.