tree コマンドがなかったので、brew install tree
としてみましたがエラーが出たので、
xcode のインストールから始めて、homebrew を更新しました。
参考
Xcode インストール
tree コマンドのインストールは、後述のcommand line tools(CLT) だけでできるそうなので、 xcodeはまだ必要ないのかもしれません。
しかし、統合開発環境として名高いxcodeが、 これまでLinuxで慣れ親しんできたEclipseやVisual Studio Codeと比べてどうなんだろうか、 と気になりました。
それで、App Store を立ち上げて、xcode を検索。「入手」をクリック。バージョンは Xcode 13.4 。 なんとインストーラーのサイズ 12.6Gbで、ダウンロードとインストールに一晩(12時間)かかりました。orz
余計な時間をかけてしまったかも。。
ただ、 CommandLineToolsとXcode - Qiita
によれば、 ver. 6.1 以降は App Storeから xcode をインストールすると、同時に CLTもインストールされるそうです。
command line tools インストール
xcodeをインストールせずに、CTLだけをインストールする場合は、
$ xcode-select --install
でコマンドラインからできます。(やってみたら、30分ほどで完了。)
homebrew アップデート
これは前にインストールしたので、アップデートしました。
インストールは
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
。
アップデートするために brew update
とすると
Error: homebrew-core is a shallow clone. homebrew-cask is a shallow clone. To `brew update`, first run: git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow ... We don't do this for you automatically to avoid repeatedly performing an expensive unshallow operation in CI systems (which should instead be fixed to not use shallow clones). Sorry for the inconvenience!
とエラーが出ましたが、
$ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow $ git -C /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask fetch --unshallow $ brew update
で無事にアップデートできました。
tree コマンドのインストール
treeコマンドがインストールできることを下記のように確認しました。
$ brew install tree $ which tree /usr/local/bin/tree