Home > Net >  How can I use Composer with MAMP PRO on macOS?
How can I use Composer with MAMP PRO on macOS?

Time:08-25

I'm on a Mac using macOS Monterey.

I'm trying to install and use Composer so that I can use it in MAMP.

I've followed a few tutorials to do this, but I am still unable to get terminal to recognize the command 'composer'.

It fails with the error:

env: php: No such file or directory

The composer executable is available here:

/Applications/Mamp/bin/composer

My .zshrc has the following alias:

alias phpmamp='/Applications/MAMP/bin/php/php7.4.12/bin/php'

How can I make Composer available for my PHP projects?

CodePudding user response:

Your question sounds like you have problems to actually read/parse the message:

> env: php: No such file or directory
  1. env: - this is the name of the utility (env(1)) that gives the message. if you don't know what it does and what is for, continue consulting the manual now as otherwise you have problems to decipher the rest of the message:

  2. php: No such file or directory

In your environment, php is not available as a file or directory. It could not be resolved.

Whatever the consequences on your own configured system are can not be said without further information.

But next to reading about the utility in use - env(1) - and given the name of the other utility - php(1) - you can normally gather more information by obtaining the absolute path of php on your system first. There are only two options:

  1. there is no such file named php.
  2. there is such a file named php and you know it's full and absolute path now.

The rest you find in the env(1) documentation.

Hope this gets you back starting and you learn a bit more how your operating system works you want to use for development.

  • Related