0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Mac SierraにComposerをインストール

Posted at

Mac SierraにComposerをインストール

Wordpressのテスト用にcodeceptionを導入しようとしたが、新しいMacにComposerを入れていなかったのでメモメモ

Composerとは?

Composer

Composer is a tool for dependency management in PHP. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.

ComposerはPHPの依存関係管理ツールである。Composerはプロジェクトが依存するライブラリを明らかにし、インストールやアップデートの管理を可能にする。(意訳)

環境

  • macOS Sierra 10.12.1

Macへのインストール

Homebrewでパッケージインストールです。

$ brew install homebrew/php/composer
Updating Homebrew...
==> Tapping homebrew/php
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-php'...
remote: Counting objects: 660, done.
remote: Compressing objects: 100% (430/430), done.
remote: Total 660 (delta 429), reused 299 (delta 228), pack-reused 0
Receiving objects: 100% (660/660), 278.81 KiB | 378.00 KiB/s, done.
Resolving deltas: 100% (429/429), done.
Tapped 636 formulae (676 files, 1.2M)
==> Installing composer from homebrew/php
==> Installing dependencies for homebrew/php/composer: libpng, freetype, icu4c, jpeg, unixodbc, php70
==> Installing homebrew/php/composer dependency: libpng
....
$ composer -V
Composer version 1.2.4 2016-12-06 22:00:51

依存関係にあったphp70もインストールしてくれていますし、パスも通してくれます。

✩✩✩✩ 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"

こんな注意もしてくれるので、どうせなのでPHP-CLIもphp7を使えるようにします。

.bashrcや.zshrcに下記内容を記載します。

# Enable PHP70
export PATH="$(brew --prefix homebrew/php/php70)/bin:$PATH"
$ php -v
PHP 7.0.14 (cli) (built: Dec  9 2016 07:34:25) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies

以上で完了です。

0
1
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?