macOS Sierra に brew で phpunit をインストールしたときにドハマりしたので対応をまとめました。
失敗編が多くてグダグダになってしまっていますが我慢してください…w
$ brew install phpunit
Warning: You are using OS X 10.12.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
==> Installing phpunit from homebrew/php
==> Installing dependencies for homebrew/php/phpunit: gettext, icu4c, libxml2, unixodbc, php71
==> Installing homebrew/php/phpunit dependency: gettext
...
...
==> Installing homebrew/php/phpunit dependency: php71
==> Downloading https://php.net/get/php-7.1.8.tar.bz2/from/this/mirror
==> Downloading from https://secure.php.net/distributions/php-7.1.8.tar.bz2
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/php71/7.1.8_20 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc/php/7.1 --with-config-file-path=/usr/local/
Last 15 lines from /Users/xxxx/Library/Logs/Homebrew/php71/01.configure:
checking for Kerberos support... /usr
checking whether to use system default cipher list instead of hardcoded value... no
checking for krb5-config... /usr/bin/krb5-config
checking for RAND_egd... no
checking for pkg-config... no
checking for OpenSSL version... >= 1.0.1
checking for CRYPTO_free in -lcrypto... yes
checking for SSL_CTX_set_ssl_version in -lssl... yes
checking for PCRE library to use... bundled
checking whether to enable PCRE JIT functionality... yes
checking whether to enable the SQLite3 extension... yes
checking bundled sqlite3 library... yes
checking for ZLIB support... yes
checking if the location of ZLIB install directory is defined... no
configure: error: Cannot find libz
READ THIS: https://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/brew):
https://github.com/Homebrew/homebrew-php/issues
These open issues may also help:
Cannot install php71-redis https://github.com/Homebrew/homebrew-php/issues/4061
php71-stemmer https://github.com/Homebrew/homebrew-php/pull/3630
homebrew/php/php71: this formula has no --with-httpd option so it will be ignored! https://github.com/Homebrew/homebrew-php/issues/4494
PHP 7.1 installation brew install php71 --with-httpd24 fails https://github.com/Homebrew/homebrew-php/issues/4192
Warning: You are using OS X 10.12.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
$ brew upgrade
Warning: You are using OS X 10.12.
We do not provide support for this pre-release version.
You may encounter build failures or other breakages.
macOS 10.12 (Sierra) にしてから brew upgrade が実行されない
$ cd $(brew --repo); git fetch; git reset --hard origin/master
remote: Counting objects: 90033, done.
remote: Compressing objects: 100% (22780/22780), done.
remote: Total 90033 (delta 65537), reused 89491 (delta 65052), pack-reused 0
Receiving objects: 100% (90033/90033), 20.06 MiB | 4.38 MiB/s, done.
Resolving deltas: 100% (65537/65537), completed with 287 local objects.
From https://github.com/Homebrew/brew
0123e04fa..56458f03f master -> origin/master
* [new tag] 0.1 -> 0.1
...
...
* [new tag] 1.3.3 -> 1.3.3
* [new tag] 1.3.4 -> 1.3.4
* [new tag] 1.3.5 -> 1.3.5
warning: unable to unlink CODEOFCONDUCT.md: Permission denied
error: unable to unlink old '.gitignore': Permission denied
error: unable to unlink old '.travis.yml': Permission denied
error: unable to create file CHANGELOG.md: Permission denied
error: unable to create file CODE_OF_CONDUCT.md: Permission denied
error: unable to create file CONTRIBUTING.md: Permission denied
error: unable to unlink old 'LICENSE.txt': Permission denied
error: unable to unlink old 'README.md': Permission denied
fatal: cannot create directory at 'completions': Permission denied
$ sudo git reset --hard origin/master
$ brew upgrade
Error: /usr/local is not writable. You should change the
ownership and permissions of /usr/local back to your
user account:
sudo chown -R $(whoami) /usr/local
Warning: Calling BottleSpecification.revision is deprecated!
Use BottleSpecification.rebuild instead.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/autoconf.rb:10:in `block in <class:Autoconf>'
Please report this to the homebrew/core tap!
Warning: Calling BottleSpecification.revision is deprecated!
Use BottleSpecification.rebuild instead.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/jpeg.rb:9:in `block in <class:Jpeg>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:29:in `<class:Libxml2>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:29:in `<class:Libxml2>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:29:in `<class:Libxml2>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/libxml2.rb:29:in `<class:Libxml2>'
Please report this to the homebrew/core tap!
Warning: Calling BottleSpecification.revision is deprecated!
Use BottleSpecification.rebuild instead.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/makedepend.rb:9:in `block in <class:Makedepend>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb:35:in `<class:Mysql>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb:35:in `<class:Mysql>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb:35:in `<class:Mysql>'
Please report this to the homebrew/core tap!
Warning: Calling fails_with :llvm is deprecated!
There is no replacement.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/mysql.rb:35:in `<class:Mysql>'
Please report this to the homebrew/core tap!
Warning: Calling BottleSpecification.revision is deprecated!
Use BottleSpecification.rebuild instead.
/usr/local/Library/Taps/homebrew/homebrew-core/Formula/wget.rb:11:in `block in <class:Wget>'
Please report this to the homebrew/core tap!
$ sudo chown -R $(whoami) /usr/local
$ brew install phpunit
phpunit を実行してみる
$ phpunit
PHPUnit 6.3.0 by Sebastian Bergmann and contributors.
This version of PHPUnit is supported on PHP 7.0 and PHP 7.1.
You are using PHP 5.6.30 (/usr/bin/php).
Warning: homebrew/php/php71 7.1.8_20 is already installed, it's just not linked.
You can use `brew link php71` to link this version.
とりあえず symlink をつくる
$ brew link php71
Linking /usr/local/Cellar/php71/7.1.8_20... 17 symlinks created
$ php -v
PHP 5.6.30 (cli) (built: Feb 7 2017 16:18:37)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
ここまできて、もう一度ログを見直して php71 にパスを通していないことに気が付きました。
✩✩✩✩ PHP CLI ✩✩✩✩
If you wish to swap the PHP you use on the command line, you should add the following to ~/.bashrc, ~/.zshrc, ~/.profile or your shell's equivalent configuration file:
export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"
~/.bash_profile にパスを追記する
$ echo 'export PATH="$(brew --prefix homebrew/php/php71)/bin:$PATH"' >> ~/.bash_profile
$ source ~/.bash_profile
$ php -v
dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
Referenced from: /usr/local/opt/php71/bin/php
Reason: image not found
Abort trap: 6
$ brew upgrade readline
$ php -v
dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
Referenced from: /usr/local/opt/php71/bin/php
Reason: Incompatible library version: php requires version 48.0.0 or later, but libpng16.16.dylib provides version 38.0.0
Abort trap: 6
$ brew upgrade libpng
$ php -v
dyld: Library not loaded: /usr/local/opt/freetype/lib/libfreetype.6.dylib
Referenced from: /usr/local/opt/php71/bin/php
Reason: Incompatible library version: php requires version 21.0.0 or later, but libfreetype.6.dylib provides version 19.0.0
Abort trap: 6
$ brew upgrade freetype
$ php -v
PHP 7.1.8 (cli) (built: Aug 7 2017 15:02:45) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
$ phpunit --version
PHPUnit 6.3.0 by Sebastian Bergmann and contributors.
新しい記事へ
今月やりたいことリスト(2017年10月)
mac に pip をインストールする
mac は標準で python が入っていますが、パッケージ管理の pip がインストールされていないので入れてみました。
2017/05/26 09:00
[GAS] Google Drive の特定フォルダ配下のフォルダ・ファイルの権限を一括で移譲する
Google Drive の特定フォルダ配下のファイル・フォルダの権限を一括で移譲するツールを Google Apps Script で作りました。
2018/11/10 15:54
[Windows] Ophcrack を使ってユーザーパスワードを解析する方法
家族で使っていた Windows7 のログインパスワードを忘れたため、Ophcrack を使って解析したときの記録です。
2017/09/30 21:00
[shell] フォルダ内にある大量の ZIP ファイルをまとめて解凍する
とある ZIP を解凍すると中に大量の ZIP が居たときに幸せになれるコマンドを紹介します
2018/06/19 23:45
[MySQL] データファイルから DB を復元する
先日 MySQL が再起動できなくなる問題が発生し、急遽データファイル(.frm, .ibd)から復元しました
2018/11/25 12:44