Skip to content

Instantly share code, notes, and snippets.

@emotality
Last active September 5, 2019 06:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emotality/de6329f09e732603b1464a69c557e527 to your computer and use it in GitHub Desktop.
Save emotality/de6329f09e732603b1464a69c557e527 to your computer and use it in GitHub Desktop.
Install composer on macOS

Composer on macOS

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

Notes

  • If you are using Oh My Zsh, replace ~/.bash_profile with ~/.bzshrc for all above commands.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment