18

I'm really new to MacOS so maybe this is simple question.

I'm using High Sierra with default PHP 7.1 installed, I've also installed PHP 7.2 running:

curl -s http://php-osx.liip.ch/install.sh | bash -s 7.2

When I run:

brew install composer

I'm getting:

Error: No available formula with the name "composer" 
==> Searching for a previously deleted formula...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

The question is how to install composer via homebrew? (Maybe I should somehow uninstall PHP I've installed and install PHP via homebrew?)

2 Answers 2

33

It's now possible to install composer running

brew install composer

Previous answer (for older versions):

It seems the solution was running:

brew tap homebrew/homebrew-php

and then

brew install composer

After that composer seems to be installed:

composer --version
Composer version 1.5.5 2017-12-01 14:42:57
6
  • This is long out-of-date.
    – rfay
    Jun 23, 2018 at 22:04
  • @rfay What exactly? It was working fine on High Sierra 6 months ago Jun 25, 2018 at 14:34
  • Yeah, php no longer uses the tap, php installation is just brew install php (no tap) for php 7.
    – rfay
    Jun 26, 2018 at 17:24
  • @rfay But this thread is about composer installation, not about php, right? Jun 26, 2018 at 17:27
  • 2
    Just edit to remove the tap and it will be good.
    – rfay
    Jun 26, 2018 at 17:27
6

Now as time passed, this works for me:

$ brew install composer
4
  • This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question. - From Review
    – IconDaemon
    Oct 16, 2018 at 23:50
  • 1
    Huh? This perfectly answers the question "How to install composer via homebrew?". It is even mentioned in the comments of the first answer. Any thing else not ok with my first post on AskDifferent?
    – bbjay
    Oct 17, 2018 at 10:39
  • Does it add any new information to the existing accepted answer? Merely restating the brew install composer command isn't all that helpful, to be honest. If you meant that the brew tap homebrew/homebrew-ph command is no longer needed for this process, please edit your answer to be more specific.
    – IconDaemon
    Oct 17, 2018 at 11:13
  • 1
    This was the first result on google and I personally would have found it helpful to get straight to this answer, instead of having to read the comments of the accepted answer first. Thats why I posted it, to help others. Sometimes removing information does add value. The current accepted answer still has value for users of older systems, thats why I didn't just edit it. Isn't the idea of SO that the votes decide wich answer is more helpful over time? As for being more specific, again, sometimes less is more. I did however indicate that something has changed, so one could read up if needed.
    – bbjay
    Oct 17, 2018 at 15:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .