はじめに
PHPのバージョンを8.0に上げたくHomebrewを使ってphp8.0をインストールしようとした際に、
Homebrewのアクションに失敗して悩んだのでその備忘録として記載します。
PHP8.0のインストール
Homebrewを使ってPHP8.0をインストール
brew install php@8.0
実行すると、下記エラーが発生
Error:
homebrew-core is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
==> Downloading https://homebrew.bintray.com/bottles/php-8.0.3.big_sur.bottle.tar.gz
# =#=-# #
curl: (22) The requested URL returned error: 403 Forbidden
Error: Failed to download resource "php"
Download failed: https://homebrew.bintray.com/bottles/php-8.0.3.big_sur.bottle.tar.gz
一旦、Homebrewをアップデート
brew update
実行するもエラー
Error:
homebrew-core is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
This command may take a few minutes to run due to the large size of the repository.
This restriction has been made on GitHub's request because updating shallow
clones is an extremely expensive operation due to the tree layout and traffic of
Homebrew/homebrew-core and Homebrew/homebrew-cask. We don't do this for you
automatically to avoid repeatedly performing an expensive unshallow operation in
CI systems (which should instead be fixed to not use shallow clones). Sorry for
the inconvenience!
以下を実行
git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
再度、PHP8.0のインストールを実行
brew install php@8.0
以下のエラー
==> Downloading https://homebrew.bintray.com/bottles/php-8.0.3.big_sur.bottle.tar.gz
# =#=-# #
curl: (22) The requested URL returned error: 403 Forbidden
Error: Failed to download resource "php"
Download failed: https://homebrew.bintray.com/bottles/php-8.0.3.big_sur.bottle.tar.gz
再びHomebrewを更新
brew update
再度、PHP8.0のインストールを実行
brew install php@8.0
下記エラー
Error: python@3.9: the bottle needs the Apple Command Line Tools to be installed.
You can install them, if desired, with:
xcode-select --install
You can try to install from source with:
brew install --build-from-source python@3.9
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull
requests instead of asking for help on Homebrew's GitHub, Twitter or any other
official channels.
以下を実行
xcode-select --install
ポップアップでcommand line toolをダウンロードしますかと表示されるのでインストール
そしてまたまたPHP8.0のインストールを実行
brew install php@8.0
インストール成功したので、PHP8.0のパスを通す(~/.bash_profile)