Search code examples
homebrewgdal

Error: /usr/local/Cellar/xz/5.2.4 is not a valid keg


I wanted to install package gdal on my Mac. I ran arch -x86_64 brew install gdal. However, it returned this error: Error: /usr/local/Cellar/xz/5.2.4 is not a valid keg


Solution

  • You need to run brew update before the gdal installation, the latest xz is 5.4.1.

    If still does not work, can you also update the OP and include brew config and brew doctor outputs?