skip to Main Content

I try to install [email protected] using brew. But, it return error because it is versioned formula. What is it?

command: brew install [email protected]

result: Error: [email protected] has been disabled because it is a versioned formula!

6

Answers


  1. You can only install supported versions of PHP with brew. However, there is the tap shivammathur/php which can be used to install unsupported version of PHP.

    1. brew tap shivammathur/php
    2. brew install shivammathur/php/[email protected]
    3. brew link [email protected]

    The first step only needs to be done once. After adding the tap, you can install PHP version 5.6 – 8.2.

    Login or Signup to reply.
  2. BTW, brew install [email protected] gives out same warning, but does install php7, so this could be an option

    Login or Signup to reply.
  3. I applied the same instructions given by @derhansen and worked very well for [email protected]:

    brew tap shivammathur/php
    brew install shivammathur/php/[email protected]
    brew link [email protected]
    
    Login or Signup to reply.
  4. You can also edit the formula and re-enable it. These steps worked for me:

    1. brew edit [email protected]
    2. Look for disable! date: "2022-11-28", because: :versioned_formula. Change 2022 to 2023
    3. brew install [email protected]

    The bottles still exist online, so installation was very fast, but I assume that they will eventually be deleted, forcing a slow compile instead.

    Login or Signup to reply.
  5. For anyone having this issue 2023…

    The accepted answer is an unnessercery step.

    @Mike’s answer is the better one, but is missing one important step.

    HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]

    HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]

    HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]

    HOMEBREW_NO_INSTALL_FROM_API=1 brew install [email protected]

    Brew tells you, when you edit the Formula:

    Warning: Unless `HOMEBREW_NO_INSTALL_FROM_API` is set when running
    `brew install`, it will ignore your locally edited formula.
    Editing /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/[email protected]
    Warning: Using code because no editor was set in the environment.
    This may change in the future, so we recommend setting EDITOR,
    or HOMEBREW_EDITOR to your preferred text editor.
    

    This way, you still use the official formula.
    This of course, works for any formula.

    So, just remove the following two lines from the formula:

      brew edit {{ formula }} // ex: brew edit [email protected]
    
      keg_only :versioned_formula
    
      disable! date: "2022-11-28", because: :versioned_formula
    
    Login or Signup to reply.
  6. When you are using homebrew to install PHP you need to know the versions that are been supported by homebrew.
    If you need to install an unsupported version you can do it by running these commands

    brew tap shivammathur/php
    brew install shivammathur/php/[email protected]
    brew link [email protected]
    

    And then if ypu need to check the current version and then shift between php version you can run

    php -v
    brew unlink php
    brew link [email protected]
    
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search