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.
-
What **exactly** is not working yet? What have you tried to resolve your problem? Where are you stuck? – Nico Haase Apr 20 '23 at 10:10
1 Answers
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:
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

- 8,234
- 24
- 88
- 138