LoginSignup
16
18

More than 3 years have passed since last update.

macOS CatalinaにしてからLaravelの環境設定が詰まった

Last updated at Posted at 2020-01-27

Laravelの環境設定で詰まった

使用環境
MacOS Catalina
php Version 7.3.8
composer version 1.9.2
Laravel installer 3.0.1

<発生した問題>
composerを使用して、下記コマンドでlaravelインストールを実行しました。

composer global require laravel/installer

すると、

-laravel/installer v3.0.1 requires ext-zip * -> the requested PHP extension zip is missing from your system. 

-laravel/installer v3.0.0 requires ext-zip * -> the requested PHP extension zip is missing from your system. 

-Installation request for laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.0, v3.0.1].

こういったエラーが吐き出されました。
(PHPのzipの拡張機能をインストールしてくださいということみたい)

phpは入ってるよなぁ、と思いつつ調べていくと、この記事にたどり着いた。

https://stackoverflow.com/questions/58290566/install-ext-zip-for-mac/58300437#comment102952298_58290566

原因は分かりませんが、僕の環境のphpにはzipが存在しないみたい。
なので、下記コマンドでそのzipを含んだphpをインストールします。

brew update
brew install php@7.4
brew link php@7.4

それで、あとは再度composerでlaravelをインストールします。

あ、laravelコマンドは下記コマンドでパスを繋いであげないといけないのでお忘れなく。

export PATH=$PATH:$HOME/.composer/vendor/bin
source ~/.bash_profile

もし、これでターミナルを再起動した場合でまたコマンドが使えない場合があった場合。
ログインシェルがbashになっていない場合があるので、それを変えてあげましょう。
ちなみに僕の場合は、zshになっていました。
自動で.bash_profileを読みに行かないので、パスが通らないんですね。

以上です。

16
18
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
16
18