0. 環境
- Mac OS X 10.11
- Homebrew
1. Install
$ brew install Composer
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
infer
Error: No available formula with the name "composer"
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
These formulae were found in taps:
homebrew/completions/composer-completion homebrew/php/composer
To install one of them, run (for example):
brew install homebrew/completions/composer-completion
パッケージ名が違ってた。
composer-completion もあるようなのでついでにインストールする。
$ brew install homebrew/php/composer homebrew/completions/composer-completion
==> Tapping homebrew/php
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-php'...
remote: Counting objects: 642, done.
remote: Compressing objects: 100% (395/395), done.
remote: Total 642 (delta 345), reused 499 (delta 245), pack-reused 0
Receiving objects: 100% (642/642), 303.89 KiB | 213.00 KiB/s, done.
Resolving deltas: 100% (345/345), done.
Checking connectivity... done.
Tapped 617 formulae (657 files, 1.2M)
==> Tapping homebrew/completions
Cloning into '/usr/local/Library/Taps/homebrew/homebrew-completions'...
remote: Counting objects: 41, done.
remote: Compressing objects: 100% (36/36), done.
remote: Total 41 (delta 8), reused 21 (delta 5), pack-reused 0
Unpacking objects: 100% (41/41), done.
Checking connectivity... done.
Tapped 36 formulae (101 files, 67.9K)
==> Installing composer from homebrew/php
==> Installing dependencies for homebrew/php/composer: libpng, freetype, icu4c, jpeg, libxml2, unixodbc, readline, php70
==> Installing homebrew/php/composer dependency: libpng
==> Downloading https://homebrew.bintray.com/bottles/libpng-1.6.24.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libpng-1.6.24.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/libpng/1.6.24: 26 files, 1.2M
==> Installing homebrew/php/composer dependency: freetype
==> Downloading https://homebrew.bintray.com/bottles/freetype-2.6.5.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring freetype-2.6.5.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/freetype/2.6.5: 61 files, 2.5M
==> Installing homebrew/php/composer dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-57.1.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring icu4c-57.1.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides libicucore.dylib (but nothing else).
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/icu4c/lib
CPPFLAGS: -I/usr/local/opt/icu4c/include
==> Summary
🍺 /usr/local/Cellar/icu4c/57.1: 265 files, 65.0M
==> Installing homebrew/php/composer dependency: jpeg
==> Downloading https://homebrew.bintray.com/bottles/jpeg-8d.el_capitan.bottle.2.tar.gz
######################################################################## 100.0%
==> Pouring jpeg-8d.el_capitan.bottle.2.tar.gz
🍺 /usr/local/Cellar/jpeg/8d: 19 files, 713.8K
==> Installing homebrew/php/composer dependency: libxml2
==> Downloading https://homebrew.bintray.com/bottles/libxml2-2.9.4.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring libxml2-2.9.4.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/libxml2/lib
CPPFLAGS: -I/usr/local/opt/libxml2/include
==> Summary
🍺 /usr/local/Cellar/libxml2/2.9.4: 276 files, 9.8M
==> Installing homebrew/php/composer dependency: unixodbc
==> Downloading https://homebrew.bintray.com/bottles/unixodbc-2.3.4.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring unixodbc-2.3.4.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/unixodbc/2.3.4: 39 files, 952.4K
==> Installing homebrew/php/composer dependency: readline
==> Downloading https://homebrew.bintray.com/bottles/readline-6.3.8.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring readline-6.3.8.el_capitan.bottle.tar.gz
==> Caveats
This formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides the BSD libedit library, which shadows libreadline.
In order to prevent conflicts when programs look for libreadline we are
defaulting this GNU Readline installation to keg-only.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you'll need to add to your
build variables:
LDFLAGS: -L/usr/local/opt/readline/lib
CPPFLAGS: -I/usr/local/opt/readline/include
==> Summary
🍺 /usr/local/Cellar/readline/6.3.8: 46 files, 2.0M
==> Installing homebrew/php/composer dependency: php70
==> Downloading https://homebrew.bintray.com/bottles-php/php70-7.0.10_1.el_capitan.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring php70-7.0.10_1.el_capitan.bottle.1.tar.gz
==> Caveats
To enable PHP in Apache add the following to httpd.conf and restart Apache:
LoadModule php7_module /usr/local/opt/php70/libexec/apache2/libphp7.so
<FilesMatch .php$>
SetHandler application/x-httpd-php
</FilesMatch>
Finally, check DirectoryIndex includes index.php
DirectoryIndex index.php index.html
The php.ini file can be found in:
/usr/local/etc/php/7.0/php.ini
✩✩✩✩ Extensions ✩✩✩✩
If you are having issues with custom extension compiling, ensure that
you are using the brew version, by placing /usr/local/bin before /usr/sbin in your PATH:
PATH="/usr/local/bin:$PATH"
PHP70 Extensions will always be compiled against this PHP. Please install them
using --without-homebrew-php to enable compiling against system PHP.
✩✩✩✩ 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/php70)/bin:$PATH"
✩✩✩✩ FPM ✩✩✩✩
To launch php-fpm on startup:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/opt/php70/homebrew.mxcl.php70.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.php70.plist
The control script is located at /usr/local/opt/php70/sbin/php70-fpm
OS X 10.8 and newer come with php-fpm pre-installed, to ensure you are using the brew version you need to make sure /usr/local/sbin is before /usr/sbin in your PATH:
PATH="/usr/local/sbin:$PATH"
You may also need to edit the plist to use the correct "UserName".
Please note that the plist was called 'homebrew-php.josegonzalez.php70.plist' in old versions
of this formula.
To have launchd start homebrew/php/php70 now and restart at login:
brew services start homebrew/php/php70
==> Summary
🍺 /usr/local/Cellar/php70/7.0.10_1: 332 files, 49.5M
==> Installing homebrew/php/composer
==> Downloading https://homebrew.bintray.com/bottles-php/composer-1.2.0.el_capitan.bottle.tar.gz
######################################################################## 100.0%
==> Pouring composer-1.2.0.el_capitan.bottle.tar.gz
🍺 /usr/local/Cellar/composer/1.2.0: 4 files, 1.6M
==> Installing composer-completion from homebrew/completions
==> Downloading https://gist.githubusercontent.com/tonglil/753d59d6d649f85600fe/raw/854fcb2f5a4cae824119d6c5c40a2bde4e541689/composer-completion.sh
######################################################################## 100.0%
==> Caveats
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
==> Summary
🍺 /usr/local/Cellar/composer-completion/1: 2 files, 1.1K, built in 3 seconds
2. 依存関係
手元の環境だと composer の依存関係で下記まで入ってきた……(phpもなのか……)
- libpng
- freetype
- icu4c
- jpeg
- libxml2
- unixodbc
- readline
- php70
依存関係はこんな感じ。
$ brew deps --tree composer
homebrew/php/composer (required dependencies)
└── :php70
$ brew deps --tree php70
homebrew/php/php70 (required dependencies)
└── :postgresql
├── freetype
│ └── libpng
│ └── xz
├── gettext
│ └── xz
├── icu4c
├── jpeg
├── libpng
│ └── xz
├── libxml2
│ └── :python
├── unixodbc
├── readline
└── openssl
└── makedepend
└── pkg-config