LoginSignup
11
14

More than 5 years have passed since last update.

Homebrewでphp-intlがインストール出来ない時の解消法

Last updated at Posted at 2018-07-02

Macローカル環境でCakePHP3のプロジェクトを作ろうとしたら、intlが無いからエラーが出てしまい、homebrewでintlインストールを試みるも、上手くいかずに結構時間を浪費したので、解消法のメモ書きです。

Homebrewでphp-intlがインストール出来ない

ComposerでCakePHP3のプロジェクトを作ろうとすると。

composer self-update && composer create-project --prefer-dist cakephp/app cms
[実行結果]
Problem 1
- cakephp/cakephp 3.6.6 requires ext-intl * -> the requested PHP extension intl is missing from your system.

Homebrewでintlインストールを試みる。

brew install php71-intl
(実行結果)
Error: No formulae found in taps.

brew search intl
[実行結果]
==> Searching local taps...
intltool
==> Searching taps on GitHub...
==> Searching blacklisted, migrated and deleted formulae...

こちらのブログに詳しい事が記載されていました。
どうやらintlが無くなっている模様。
http://rskull.hateblo.jp/entry/2018/04/06/164236

Homebrew再インストールしてPHP71インストール

そもそもローカル環境のHomebrewが随分古かったので際インストールすることに。

[アンインストール]
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

[インストール]
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Homebrewで最新のPHPをインストール。

brew install php@7.1

パスを通す

このままではデフォルトでインストールされているPHPになっている。

which php
[実行結果]
/usr/bin/php

先程HomebrewでインストールしたPHPにパスを通す。

vi ~/.bash_profile
export PATH=$PATH:/usr/local/opt/php@7.1/bin/php
source ~/.bashrc

パスの確認。

which php
[実行結果]
/usr/local/bin/php

php -m | grep intl
[実行結果]
intl

ようやくintlがインストールされました。

この状態であればCakePHPのプロジェクト作成もエラーにならず、正常終了出来ました。

composer self-update && composer create-project --prefer-dist cakephp/app cms
11
14
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
11
14