2
0

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.

MacOS Catalina zsh HomeBrew リンク・パスを通す

2
Last updated at Posted at 2020-01-22

Terminalで諸々動かなくなった(bash->zsh)

  • MySQL
  • mysql.server start 実行できない
  • PHP
  • php -v 実行できない

※ cat ~/.bash_profile >> ~/.zshrc でもよかったかも😅

MySQL

mysql.server start 実行できない

# MySQL確認
yasuken@mba13 % ls /usr/local/Cellar/mysql*

# 実行結果
/usr/local/Cellar/mysql:
8.0.19

/usr/local/Cellar/mysql@5.7:
5.7.22	5.7.24

# デフォルト8.0 unlink
yasuken@mba13 ~ % brew unlink mysql

# 実行結果
Unlinking /usr/local/Cellar/mysql/8.0.19... 92 symlinks removed

# 5.7 link
yasuken@mba13 ~ % brew link mysql@5.7

# 実行結果
Warning: mysql@5.7 is keg-only and must be linked with --force

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc

# パスを通す
yasuken@mba13 ~ % echo 'export PATH="/usr/local/opt/mysql@5.7/bin:$PATH"' >> ~/.zshrc

# パス読み込み
yasuken@mba13 ~ % source ~/.zshrc

# MySQL起動
yasuken@mba13 ~ % sudo mysql.server start

# 実行結果
Starting MySQL
.... SUCCESS!

PHP

php -v 実行できない

# PHP確認
yasuken@mba13 ~ % ls /usr/local/Cellar/php*

# 実行結果
/usr/local/Cellar/php:
7.3.11

/usr/local/Cellar/php@7.1:
7.1.16_1	7.1.18		7.1.19		7.1.25

/usr/local/Cellar/php@7.2:
7.2.19_1

# PHP7.2 link
yasuken@mba13 ~ % brew link php@7.2

# 実行結果
Warning: php@7.2 is keg-only and must be linked with --force

If you need to have this software first in your PATH instead consider running:
  echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.zshrc

# パスを通す
yasuken@mba13 ~ %   echo 'export PATH="/usr/local/opt/php@7.2/bin:$PATH"' >> ~/.zshrc
  echo 'export PATH="/usr/local/opt/php@7.2/sbin:$PATH"' >> ~/.zshrc

# パス読み込み
yasuken@mba13 ~ % source ~/.zshrc

# PHPバージョン確認
yasuken@mba13 ~ % php -v

# 実行結果
PHP 7.2.19 (cli) (built: Jun 17 2019 09:03:55) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.19, Copyright (c) 1999-2018, by Zend Technologies

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?