Homebrewでipコマンドをインストールする

- 環境
    - macOS Monterey version12.2.1
    - Homebrew 3.3.15
- 参考 : [Macにipコマンドをインストールする](https://koejima.com/archives/283/)

# 1. Homebewを最新化する
最新化(update)して健康診断(doctor)もしておく。

```bash
# 最新化して
$ brew update
Already up-to-date.

# 健康診断しておく
$ brew doctor
Your system is ready to brew.
```

# 2. iproute2macをインストールする

```bash
# iproute2macがHomebrewにいるか確認する
$ brew search iproute2mac
==> Formulae
iproute2mac                                    iproute2

# iproute2macをインストールする
$ brew install iproute2mac
Running `brew update --preinstall`...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/cask).
==> Updated Casks
Updated 2 casks.

==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/manifests/1.23
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/ce78100f130177bffd255fda9df551477edd224a5080cb86cac12818954a7438--gdbm-1.23.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/gdbm/blobs/sha256:0d0aeea95f9e7b4ccfa1e8d7f3a83b3b4d604eac1178e4f88ad51d132ad1f7cd
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/bfb25c16615f255ea8bea9838ce8687d7939dd2b031acc723bc5879c76c23595--gdbm--1.23.monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2022-02-01
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/71ac62c4bcfda042e53bfef7a7351f5a5980412a74848ec9b30e0b4dbc67573f--ca-certificates-2022-02-01.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:40e00f88df310bc2dc42aefb3e834c0a3022f125fecdf21f26431d12a104dbc0
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/e252fa1dfe90fe7bb533a0dbf1969d64620a184369ada280d2b226c784bcc3bf--ca-certificates--2022-02-01.all.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/manifests/1.1.1m
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/2bd04ba59408cbad6dce70fa2442a6c8997084cc474815d3a08863f9518dd9c9--openssl@1.1-1.1.1m.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/openssl/1.1/blobs/sha256:bac056f55bf254752ed522eccf37cf2c7cfdc38d46b2c469a777f5feb41cbbc4
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/7fb67f16d709ac1c667346f23e7b85b8559bfd87e6248925c7e5a95c1c49f5bd--openssl@1.1--1.1.1m.monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/manifests/3.37.2
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/18c7586e752d7820ae9dbd2cbd61bdc3444f0233dc6d8b3afdf00644c3122afe--sqlite-3.37.2.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/sqlite/blobs/sha256:263146083f3cffb859312957fbb6b4dd8a11c87dafe22f3d3712d39566dfd026
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/471ec73166ce12e6b698e7d405f5efd48e9256eaab9558b26d056f90b5d5dbc7--sqlite--3.37.2.monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/manifests/3.10.2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.10/blobs/sha256:918832ba425fd69b11127d6fae079e7be28b8636a9e977a9d482917f5d9f50fa
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:918832ba425fd69b11127d6fae079e7be28b8636a9e977a9d482917f5d9f50fa?se=2022-02-21T10%3A55%3A00Z&sig=9wo
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/iproute2mac/manifests/1.3.0_2
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/iproute2mac/blobs/sha256:6ae5a1243448e699b5e82c093c9dfcdcdc13b84b586f7d77bc1959c6942ad21c
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:6ae5a1243448e699b5e82c093c9dfcdcdc13b84b586f7d77bc1959c6942ad21c?se=2022-02-21T10%3A55%3A00Z&sig=wOm
######################################################################## 100.0%
==> Installing dependencies for iproute2mac: gdbm, ca-certificates, openssl@1.1, sqlite and python@3.10
==> Installing iproute2mac dependency: gdbm
==> Pouring gdbm--1.23.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/gdbm/1.23: 24 files, 956.7KB
==> Installing iproute2mac dependency: ca-certificates
==> Pouring ca-certificates--2022-02-01.all.bottle.tar.gz
==> Regenerating CA certificate bundle from keychain, this may take a while...
🍺  /usr/local/Cellar/ca-certificates/2022-02-01: 3 files, 213.4KB
==> Installing iproute2mac dependency: openssl@1.1
==> Pouring openssl@1.1--1.1.1m.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/openssl@1.1/1.1.1m: 8,081 files, 18.5MB
==> Installing iproute2mac dependency: sqlite
==> Pouring sqlite--3.37.2.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/sqlite/3.37.2: 11 files, 4.3MB
==> Installing iproute2mac dependency: python@3.10
==> Pouring python@3.10--3.10.2.monterey.bottle.tar.gz
==> /usr/local/Cellar/python@3.10/3.10.2/bin/python3 -m ensurepip
==> /usr/local/Cellar/python@3.10/3.10.2/bin/python3 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/usr/local/lib/python3.10/site-packages /usr/local/Cellar/pytho
🍺  /usr/local/Cellar/python@3.10/3.10.2: 3,133 files, 56.4MB
==> Installing iproute2mac
==> Pouring iproute2mac--1.3.0_2.all.bottle.tar.gz
🍺  /usr/local/Cellar/iproute2mac/1.3.0_2: 6 files, 23.8KB
==> Running `brew cleanup iproute2mac`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
==> Upgrading 2 dependents:
Disable this behaviour by setting HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
python@3.9 3.9.7_1 -> 3.9.10, node 17.0.1 -> 17.5.0
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/manifests/3.9.10
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/269953377ed89335a8cd22c98d16643eef3425b93f01c77109e4f261a36439d8--python@3.9-3.9.10.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/python/3.9/blobs/sha256:be3b63b24b595b7dadd25913c916cdf1c451cd5cf8068b3b2e98e6d8c40012a4
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/d3fc32ad2ea44b9f09d6b3dc029c2323b7fe290789f4b0008e0a464b5ceab49d--python@3.9--3.9.10.monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/c-ares/manifests/1.18.1_1
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/e04f95fff9f8b08d4ae0cd5cbfda6c1cd620a1a30581cd3be0b0c5853186fb9d--c-ares-1.18.1_1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/c-ares/blobs/sha256:62b9590a3b9d30d2db8696da78948fb79a26c139536c3820c4275327fd808559
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/5c3b3498497d50a669bf0b9df37f3369e8ec23e18a83cc34ed4939a53ea60be6--c-ares--1.18.1_1.monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/libuv/manifests/1.43.0
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/9e77b07b92c88d2c90b30a7a367321feaf58483be474173528fa70b715478330--libuv-1.43.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/libuv/blobs/sha256:0544ef6db3658b228088960be43db6018a5223a09cb7c577d361c017bb1b0419
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/5bea965414edd356039454c5ac82b91184bdfa81c12cb3db4ecbd2ab33153ef1--libuv--1.43.0.monterey.bottle.tar.gz
==> Downloading https://ghcr.io/v2/homebrew/core/node/manifests/17.5.0
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/b7666817cad3def1a3c831e807c6df289d22d9209deb18ec4b06142dfcffd4d1--node-17.5.0.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/node/blobs/sha256:378c69d9cb2c683eaaebe700ac622a5a8c6913b799fbadd3e0997a839b6a125d
Already downloaded: /Users/ponsuke/Library/Caches/Homebrew/downloads/4c84ebc1b1308b1748d429dff9e7b39b4c728b2dc8d542aa670c313a367c0c26--node--17.5.0.monterey.bottle.tar.gz
==> Upgrading python@3.9
  3.9.7_1 -> 3.9.10 

==> Pouring python@3.9--3.9.10.monterey.bottle.tar.gz
==> /usr/local/Cellar/python@3.9/3.9.10/bin/python3 -m ensurepip
==> /usr/local/Cellar/python@3.9/3.9.10/bin/python3 -m pip install -v --no-deps --no-index --upgrade --isolated --target=/usr/local/lib/python3.9/site-packages /usr/local/Cellar/python@
==> Caveats
Python has been installed as
  /usr/local/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.9/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.9/site-packages

tkinter is no longer included with this formula, but it is available separately:
  brew install python-tk@3.9

See: https://docs.brew.sh/Homebrew-and-Python
==> Summary
🍺  /usr/local/Cellar/python@3.9/3.9.10: 3,080 files, 54.9MB
==> Running `brew cleanup python@3.9`...
Removing: /usr/local/Cellar/python@3.9/3.9.7_1... (3,080 files, 54.6MB)
==> Upgrading node
  17.0.1 -> 17.5.0 

==> Installing dependencies for node: c-ares and libuv
==> Installing node dependency: c-ares
==> Pouring c-ares--1.18.1_1.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/c-ares/1.18.1_1: 87 files, 645.3KB
==> Installing node dependency: libuv
==> Pouring libuv--1.43.0.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/libuv/1.43.0: 49 files, 3.5MB
==> Installing node
==> Pouring node--17.5.0.monterey.bottle.tar.gz
🍺  /usr/local/Cellar/node/17.5.0: 2,013 files, 45.9MB
==> Running `brew cleanup node`...
Removing: /usr/local/Cellar/node/17.0.1... (2,008 files, 45.1MB)
==> Checking for dependents of upgraded formulae...
==> No broken dependents found!
==> Caveats
==> python@3.9
Python has been installed as
  /usr/local/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.9/libexec/bin

You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.9/site-packages

tkinter is no longer included with this formula, but it is available separately:
  brew install python-tk@3.9

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

# 3. 本当にインストールされたか確認する
```bash
# 使い方を見てみる
$ ip help
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip -V
where  OBJECT := { link | addr | route | neigh }
       OPTIONS := { -4 | -6 }

iproute2mac
Homepage: https://github.com/brona/iproute2mac
This is CLI wrapper for basic network utilities on Mac OS X inspired with iproute2 on Linux systems.
Provided functionality is limited and command output is not fully compatible with iproute2.
For advanced usage use netstat, ifconfig, ndp, arp, route and networksetup directly.

# バージョンを見てみる
$ ip -V
iproute2mac, v1.3.0
```

# いらなくなったらアンインストールする
```zsh
# インストールされているもののなかにあることを確認する
$ brew list | grep ip
iproute2mac

# アンインストールする
$ brew uninstall --force iproute2mac
Uninstalling iproute2mac... (6 files, 23.9KB)
```