はじめに
アップルのパソコンにてtreeコマンドを利用できるようにした手順とそのログです。
以下のようにファイルを木構造で一覧化できます。
?||
└── TestUITests
├── Info.plist
└── TestUITests.swift
|
環境情報
- Mac OS X : 10.15.4
- Homebrew 2.2.13
- tree v1.8.0
Brewコマンドをインストールする
ターミナルにて/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
を発行します。
以下は成功した場合の画面ログです。
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" ==> This script will install: /usr/local/bin/brew /usr/local/share/doc/homebrew /usr/local/share/man/man1/brew.1 /usr/local/share/zsh/site-functions/_brew /usr/local/etc/bash_completion.d/brew /usr/local/Homebrew ==> The Xcode Command Line Tools will be installed. Press RETURN to continue or any other key to abort ==> Searching online for the Command Line Tools ==> /usr/bin/sudo /usr/bin/touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> Installing Command Line Tools for Xcode-11.4 ==> /usr/bin/sudo /usr/sbin/softwareupdate -i Command\ Line\ Tools\ for\ Xcode-11.4 Software Update Tool Downloading Command Line Tools for Xcode Downloaded Command Line Tools for Xcode Installing Command Line Tools for Xcode Done with Command Line Tools for Xcode Done. ==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress ==> /usr/bin/sudo /usr/bin/xcode-select --switch /Library/Developer/CommandLineTools ==> Downloading and installing Homebrew... remote: Enumerating objects: 43, done. remote: Counting objects: 100% (43/43), done. remote: Compressing objects: 100% (43/43), done. remote: Total 135089 (delta 0), reused 43 (delta 0), pack-reused 135046 Receiving objects: 100% (135089/135089), 32.61 MiB | 4.44 MiB/s, done. Resolving deltas: 100% (99272/99272), done. From https://github.com/Homebrew/brew * [new branch] master -> origin/master ... * [new tag] 2.2.9 -> 2.2.9 HEAD is now at 20f7f266a Merge pull request #7415 from bayandin/fix-pushing-bottles ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Tapping homebrew/core Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'... remote: Enumerating objects: 66, done. remote: Counting objects: 100% (66/66), done. remote: Compressing objects: 100% (43/43), done. remote: Total 710626 (delta 36), reused 44 (delta 23), pack-reused 710560 Receiving objects: 100% (710626/710626), 287.60 MiB | 3.81 MiB/s, done. Resolving deltas: 100% (468132/468132), done. Updating files: 100% (5204/5204), done. Tapped 2 commands and 4964 formulae (5,229 files, 315.3MB). Already up-to-date. ==> Installation successful! ==> Homebrew has enabled anonymous aggregate formulae and cask analytics. Read the analytics documentation (and how to opt-out) here: https://docs.brew.sh/Analytics No analytics data has been sent yet (or will be during this `install` run). ==> Homebrew is run entirely by unpaid volunteers. Please consider donating: https://github.com/Homebrew/brew#donations ==> Next steps: - Run `brew help` to get started - Further documentation: https://docs.brew.sh
インストールを進める上でダウンロードフォルダへの権限をGUI上で求められます。ここを画面放置していると以下エラーとなりました。
Error downloading Command Line Tools for Xcode: The operation couldn’t be completed. (PKDownloadError error 8.)
Done.
Error downloading updates.
treeコマンドをインストールする
以下コマンドでインストールでき
$ brew install tree Updating Homebrew... ==> Downloading https://homebrew.bintray.com/bottles/tree-1.8.0.catalina.bottle.tar.gz ######################################################################## 100.0% ==> Pouring tree-1.8.0.catalina.bottle.tar.gz 🍺 /usr/local/Cellar/tree/1.8.0: 8 files, 121.1KB
以下コマンドでインストールが確認できます。
$ which tree /usr/local/bin/tree
終わりに
WindowsではCygwinにてapt-cygを利用してapt-getライクのインストールが行えますが、Macではbrewがそれに相当します。
特にbrewコマンドのインストールには時間がかかるのでご注意ください。