-1

How to use Composer globally after installing on MacOS Ventura? I tried all the guides I found googling, including the one on the composer website. It says it can't find the file.

Matt Welander
  • 8,234
  • 24
  • 88
  • 138

1 Answers1

0

All the instructions I find seem to assume that composer on a mac installs to .composer/composer.phar while in fact after running the php commands from getcomposer.org it installs right in the home directory.

And by default, the terminal is not bash (as most google hits ) in later MacOS but rather zsh. So this is what I had to do, after installing composer as per the instructions at getcomposer.org:

  1. open terminal (command+spacebar and type terminal if you can't find it) go to my home folder run nano .zsh add alias "composer"="php ~/composer.phar" to the (previously empty) file Save it (by pressing control+o) Exit nano (by pressing ctrl+x)

    close Terminal (command+q or the red dot) open termianl (as the first line above)

composer can now be run by just typing composer

Matt Welander
  • 8,234
  • 24
  • 88
  • 138