メニュー 閉じる

Homebrewをupdateしよう!Warning頻発しました

Homebrewは更新が大変多いパッケージマネージャーとして知られていまして、
「24時間アップデートしないとかなり古い」とか言われるとかなんとかです。

私はパッケージマネージャーを使うほど複数の言語・バージョンを並行して使うことは無いのですが、
Homebrewを入れておいたほうが良いよという先人たちの助言に従い導入しています。

Homebrewはmacでの開発環境を管理するにはおそらく妥当な方法なのでしょうが、
あまりその恩恵を受けてないためにアップデートをサボってしまいがちです。

久しぶりにbrew doctorしてみたところWarningがものすごく出ました!
それだけですが、せっかくなので一つづつ解消していきたいと思います。

 

数ヶ月brew updateしないとどうなるのか?

こうなります。

linda@lindaMBP ~ % brew -v
Homebrew 2.7.7
Homebrew/homebrew-core (git revision e2c833; last commit 2021-02-03)
Homebrew/homebrew-cask (git revision 9e4f90; last commit 2021-02-04)
linda@lindaMBP ~ % brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force

If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Alternatively, manually download them from:
https://developer.apple.com/download/more/.

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and which additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew-provided
script of the same name. We found the following "config" scripts:
/Users/linda/.pyenv/shims/python3.7-config
/Users/linda/.pyenv/shims/python3.7m-config
/Users/linda/.pyenv/shims/python-config
/Users/linda/.pyenv/shims/python3-config

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
python@3.9

Warning: Your CLT does not support macOS 11.
It is either outdated or was modified.
Please update your CLT or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force

If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Alternatively, manually download them from:
https://developer.apple.com/download/more/.

Warning: Broken symlinks were found. Remove them with `brew cleanup`:
/usr/local/share/zsh/site-functions/_brew_cask

 

brew updateしても結構時間がかかる

色々と出てきてますが、まずはとりあえずbrew updateしてみましょう。
brew updateはHomebrewのアップデートのみ行うコマンドです。

久しぶりにupdateすると普通に10分くらいかかります。

その後、brew upgradeコマンドを打ってみましょう。
Homebrewのアップデートに加えてHomebrewでインストールしたパッケージをアップデートします。

最初からbrew upgradeでも良いのですが様子見です。

linda@lindaMBP ~ % brew upgrade
==> Upgrading 13 outdated packages:
pyenv 1.2.22 -> 1.2.26
heroku/brew/heroku 7.47.6 -> 7.52.0
gdbm 1.18.1_1 -> 1.19
icu4c 67.1 -> 68.2
sqlite 3.34.0 -> 3.35.4
tcl-tk 8.6.11 -> 8.6.11_1
heroku/brew/heroku-node 12.16.2 -> 12.21.0
autoconf 2.69 -> 2.71
isl 0.22.1 -> 0.23
openssl@1.1 1.1.1i -> 1.1.1k
node 15.4.0 -> 16.0.0
python@3.8 3.8.6_2 -> 3.8.9
python@3.9 3.9.1_7 -> 3.9.4
==> Upgrading icu4c 67.1 -> 68.2
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/manifests/68.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/icu4c/blobs/sha256:ba2fd8c7d37025c93db6b03cb831bf414f085
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:ba2fd8c7d37025c93
######################################################################## 100.0%
==> Pouring icu4c--68.2.big_sur.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have icu4c first in your PATH, run:
echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.zshrc

For compilers to find icu4c you may need to set:
export LDFLAGS="-L/usr/local/opt/icu4c/lib"
export CPPFLAGS="-I/usr/local/opt/icu4c/include"

For pkg-config to find icu4c you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/icu4c/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/icu4c/68.2: 259 files, 72.5MB
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/linda/Library/Caches/Homebrew/gdbm--1.18.1_1.catalina.bottle.tar.gz... (203.8KB)
Removing: /Users/linda/Library/Caches/Homebrew/gmp--6.2.1.catalina.bottle.tar.gz... (1MB)
Removing: /Users/linda/Library/Caches/Homebrew/heroku-node--12.16.2.tar.xz... (9.5MB)
Removing: /usr/local/Cellar/icu4c/67.1... (258 files, 71.2MB)
Removing: /Users/linda/Library/Caches/Homebrew/icu4c--67.1.catalina.bottle.tar.gz... (26.8MB)
Removing: /Users/linda/Library/Caches/Homebrew/libmpc--1.2.1.catalina.bottle.tar.gz... (126KB)
Removing: /Users/linda/Library/Caches/Homebrew/mpfr--4.1.0.catalina.bottle.tar.gz... (1.2MB)
Removing: /Users/linda/Library/Caches/Homebrew/nmap--7.91.catalina.bottle.tar.gz... (7MB)
Removing: /Users/linda/Library/Caches/Homebrew/openssl@1.1--1.1.1i.catalina.bottle.tar.gz... (5.4MB)
Removing: /Users/linda/Library/Caches/Homebrew/pkg-config--0.29.2_3.catalina.bottle.tar.gz... (234.2KB)
Removing: /Users/linda/Library/Caches/Homebrew/pyenv--1.2.22.catalina.bottle.tar.gz... (646.4KB)
Removing: /Users/linda/Library/Caches/Homebrew/python@3.9--3.9.1_7.catalina.bottle.1.tar.gz... (16.7MB)
Removing: /Users/linda/Library/Caches/Homebrew/readline--8.1.catalina.bottle.tar.gz... (536.1KB)
Removing: /Users/linda/Library/Caches/Homebrew/sqlite--3.34.0.catalina.bottle.tar.gz... (2.0MB)
Removing: /Users/linda/Library/Caches/Homebrew/xz--5.2.5.catalina.bottle.tar.gz... (387.2KB)
Removing: /Users/linda/Library/Caches/Homebrew/yarn--1.22.10.tar.gz... (1.2MB)
Removing: /Users/linda/Library/Caches/Homebrew/portable-ruby-2.6.3_2.yosemite.bottle.tar.gz... (9.1MB)
Removing: /Users/linda/Library/Logs/Homebrew/gmp... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/ncurses... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/heroku... (114B)
Removing: /Users/linda/Library/Logs/Homebrew/mpfr... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/icu4c... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/yarn... (100B)
Removing: /Users/linda/Library/Logs/Homebrew/tcl-tk... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/heroku-node... (119B)
Removing: /Users/linda/Library/Logs/Homebrew/isl... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/pcre... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/node... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/zsh... (64B)
Removing: /Users/linda/Library/Logs/Homebrew/python@3.9... (3 files, 719.9KB)
Removing: /Users/linda/Library/Logs/Homebrew/libmpc... (64B)
Pruned 1 symbolic links and 2 directories from /usr/local
==> Upgrading sqlite 3.34.0 -> 3.35.4
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.35.4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/blobs/sha256:861dc044ea531c39a2105010107feb95cf10
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:861dc044ea531c39a
######################################################################## 100.0%
==> Pouring sqlite--3.35.4.big_sur.bottle.tar.gz
==> Caveats
sqlite is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have sqlite first in your PATH, run:
echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc

For compilers to find sqlite you may need to set:
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/sqlite/3.35.4: 11 files, 4.2MB
Removing: /usr/local/Cellar/sqlite/3.34.0... (11 files, 4.1MB)
==> Upgrading openssl@1.1 1.1.1i -> 1.1.1k
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1k
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:17d94c51ddfa8364baed5f3a754063e
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:17d94c51ddfa8364b
######################################################################## 100.0%
==> Pouring openssl@1.1--1.1.1k.big_sur.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@1.1/certs

and run
/usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@1.1 first in your PATH, run:
echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@1.1 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/openssl@1.1/1.1.1k: 8,071 files, 18.5MB
Removing: /usr/local/Cellar/openssl@1.1/1.1.1i... (8,067 files, 18.5MB)
==> Upgrading tcl-tk 8.6.11 -> 8.6.11_1
==> Downloading https://ghcr.io/v2/homebrew/core/tcl-tk/manifests/8.6.11_1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/tcl-tk/blobs/sha256:d9ffd39a32e602515594c4658aaab20224d9
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:d9ffd39a32e602515
######################################################################## 100.0%
==> Pouring tcl-tk--8.6.11_1.big_sur.bottle.tar.gz
==> Caveats
tcl-tk is keg-only, which means it was not symlinked into /usr/local,
because macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.

If you need to have tcl-tk first in your PATH, run:
echo 'export PATH="/usr/local/opt/tcl-tk/bin:$PATH"' >> ~/.zshrc

For compilers to find tcl-tk you may need to set:
export LDFLAGS="-L/usr/local/opt/tcl-tk/lib"
export CPPFLAGS="-I/usr/local/opt/tcl-tk/include"

For pkg-config to find tcl-tk you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/tcl-tk/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/tcl-tk/8.6.11_1: 3,041 files, 51.6MB
Removing: /usr/local/Cellar/tcl-tk/8.6.11... (3,041 files, 51.6MB)
==> Upgrading python@3.8 3.8.6_2 -> 3.8.9
==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/manifests/1.19
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/blobs/sha256:3581501b051db1c0d1acccc710fe04453b6177
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:3581501b051db1c0d
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/manifests/2.5.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/mpdecimal/blobs/sha256:255b6226cdcfaf0d40167012593e863e7
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:255b6226cdcfaf0d4
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.8/manifests/3.8.9
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.8/blobs/sha256:6111e285226a59c3c3b0f684de2a810d
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:6111e285226a59c3c
######################################################################## 100.0%
==> Installing dependencies for python@3.8: gdbm and mpdecimal
==> Installing python@3.8 dependency: gdbm
==> Pouring gdbm--1.19.big_sur.bottle.tar.gz
🍺 /usr/local/Cellar/gdbm/1.19: 24 files, 791.3KB
==> Installing python@3.8 dependency: mpdecimal
==> Pouring mpdecimal--2.5.1.big_sur.bottle.tar.gz
🍺 /usr/local/Cellar/mpdecimal/2.5.1: 71 files, 2.1MB
==> Installing python@3.8
==> Pouring python@3.8--3.8.9.big_sur.bottle.tar.gz
==> /usr/local/Cellar/python@3.8/3.8.9/bin/python3 -s setup.py --no-user-cfg install --force --verbose --
==> /usr/local/Cellar/python@3.8/3.8.9/bin/python3 -s setup.py --no-user-cfg install --force --verbose --
==> /usr/local/Cellar/python@3.8/3.8.9/bin/python3 -s setup.py --no-user-cfg install --force --verbose --
==> Caveats
Python has been installed as
/usr/local/opt/python@3.8/bin/python3

Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/usr/local/opt/python@3.8/libexec/bin

You can install Python packages with
/usr/local/opt/python@3.8/bin/pip3 install <package>
They will install into the site-package directory
/usr/local/lib/python3.8/site-packages

See: https://docs.brew.sh/Homebrew-and-Python

python@3.8 is keg-only, which means it was not symlinked into /usr/local,
because this is an alternate version of another formula.

If you need to have python@3.8 first in your PATH, run:
echo 'export PATH="/usr/local/opt/python@3.8/bin:$PATH"' >> ~/.zshrc

For compilers to find python@3.8 you may need to set:
export LDFLAGS="-L/usr/local/opt/python@3.8/lib"

For pkg-config to find python@3.8 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/python@3.8/lib/pkgconfig"

==> Summary
🍺 /usr/local/Cellar/python@3.8/3.8.9: 4,376 files, 71.4MB
Removing: /usr/local/Cellar/python@3.8/3.8.6_2... (4,526 files, 71.8MB)
==> Upgrading heroku/brew/heroku-node 12.16.2 -> 12.21.0
==> Downloading https://nodejs.org/download/release/v12.21.0/node-v12.21.0-darwin-x64.tar.xz
######################################################################## 100.0%
Error: Your Command Line Tools are too outdated.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force

If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Alternatively, manually download them from:
https://developer.apple.com/download/more/.

Error: Your Command Line Tools (CLT) does not support macOS 11.
It is either outdated or was modified.
Please update your Command Line Tools (CLT) or delete it if no updates are available.
Update them from Software Update in System Preferences or run:
softwareupdate --all --install --force

If that doesn't show you any updates, run:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

Alternatively, manually download them from:
https://developer.apple.com/download/more/.

いろいろ問題が出ているように見えますが見なかったことにしましょう。
そのパッケージを使う日が来るまでエラーがでることはありません。

 

コマンドラインツールってなんだろう?

コマンドラインツールというのは「キーボードで操作するプログラム」だそうです。

まずは簡単そうなErrorから取り組もうということで、
Error: Your Command Line Tools are too outdated.を解決します。
これは「お前のコマンドラインツールは時代遅れだよ」ということです。

基本的にはMacのXcodeをインストールするとコマンドラインツールもインストールされますが、
私はOSはupdateしていたのですがxcodeはそのままだったようです。

アップデートするには普通にソフトウェアを最新のものをインストールしても良いですし、
ライブラリの中のCLTを削除してからsudo xcode-select –installコマンドを打っても良いです。

また、Macのコマンドラインツールだけをインストールすることもできます。

私は推奨されていた下記コマンド

softwareupdate --all --install --force

が使えなかったのでこちらのコマンドでインストールしました。

sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install

これで一応使えるようにはなったはずです。

Python3系を使うときはpip3とpipの後ろに3を付けてコマンドを打ちます。
今回はそのままPython3.9をbrew install python3でインストールした上で、
pip3 install djangoとしてPythonパッケージであるdjangoを導入しました。

linda@lindaMBP ~ % pip3 install django
Collecting django
Downloading Django-3.2-py3-none-any.whl (7.9 MB)
|████████████████████████████████| 7.9 MB 9.5 MB/s
Collecting pytz
Using cached pytz-2021.1-py2.py3-none-any.whl (510 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting asgiref<4,>=3.3.2
Downloading asgiref-3.3.4-py3-none-any.whl (22 kB)
Installing collected packages: sqlparse, pytz, asgiref, django
Successfully installed asgiref-3.3.4 django-3.2 pytz-2021.1 sqlparse-0.4.1

これでDjangoも使えるようになったでしょう。

linda@lindaMBP ~ % python -m django --version
1.11.29

最後にもう一度brew doctorでHomebrewの状態を診断します。

linda@lindaMBP ~ % brew doctor
Your system is ready to brew.

「お前のシステムはbrewの準備ができているぜ!」
そう教えてくれましたね。完璧なビールを醸造しましょう。

ついでに以前pyenvを入れた環境がごちゃごちゃしてきたので、
一回pyenvを削除してから再度入れ直すことにしました。

(よくわからないときは一度リセットできるのが自主開発の強みです)

 

参考にしたサイト

brewのupdateとupgradeの違い
https://qiita.com/okhrn/items/aa71b066a525456550c0