LoginSignup
59
63

More than 5 years have passed since last update.

MacにHomebrewでComposerをインストールしました

Last updated at Posted at 2015-01-06

ComposerってBundlerみたいなものらしいので、Homebrewを使って入れようとしました。

HomebrewでComposerをインストールしようとしてエラー

HomebrewでComposerのインストールを試しました。

HomebrewでComposerをインストール
brew install homebrew/php/composer

略

composer: Missing PHP53, PHP54, PHP55 or PHP56 from homebrew-php. Please install one of them before continuing
Error: An unsatisfied requirement failed this build.

HomebrewのPHPを先に入れろとあります。おそらくMacデフォルトのPHPではだめなのだと思います。

HomebrewでPHPをインストールしようとしてエラー

新しそうなbrewのPHP56を入れることにしました。

brewでphpをインストール
brew install PHP56

略

checking for pkg-config... no
configure: error: Cannot find OpenSSL's <evp.h>
couldn't understand kern.osversion `14.0.0'

READ THIS: http://git.io/brew-troubleshooting
If reporting this issue please do so at (not Homebrew/homebrew):
  https://github.com/homebrew/homebrew-php/issues

これは、OSX10.10以上で、Xcodeを最新にした上で、関連ファイルをインストールするそうです。

以下のコマンドを実行するとコマンドラインツールのダウンロードが自動で始まります。

コマンドラインツールのインストール
xcode-select --install
xcode-select: note: install requested for command line developer tools

再度HomebrewでPHPをインストール

PHP56を再度インストールします。

brewでphpをインストール
brew install PHP56

成功しました。

もともとMacのPHPは、HomebrewでないPHPを参照していたので、ターミナルを開き直します。

PHPがHomebrew経由になったか確認
php -v
PHP 5.6.4 (cli) (built: Jan  7 2015 01:04:24) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2014 Zend Technologies

which php
/usr/local/bin/php

PHPをHomebrewが参照しています。

再度HomebrewでComposerをインストール

PHPがインストールされたので、Composerをインストールします。

HomebrewでComposerをインストール
brew install homebrew/php/composer
==> Installing composer from homebrew/homebrew-php

略

You can read more about composer and packagist by running:
  "brew home composer".
==> Summary
 /usr/local/Cellar/composer/1.0.0-alpha9: 3 files, 1.0M, built in 11 seconds

Composerがインストールできたみたいです。

Composerとコマンドを実行してComposerのインストールを確認します。

Composerを確認
composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/

略

Composerがインストールされました。

59
63
0

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
59
63