by Devin Yang

建立於: 6年前 ( 更新: 1年前 )

前言

相信Linux使用者,大概都有用過tree這個指令,我們可以透過homebrew來直接安裝tree這個指令,
但是如果我們想自行編譯進行安裝,應該如何做呢?
本文介紹如何在自己的MacOS上自行編譯tree的指令及安裝。
 

步驟如下

一、首先到如下的網站下載tree的原始檔。
http://mama.indstate.edu/users/ice/tree/

二、下載後可用tar指令進行解壓縮。

tar zxvf tree-2.1.0.tgz


三、 cd tree-2.1.0/ 進入資料夾中。
四、查看安裝說明,在MacOS上我們一樣可以用 cat  INSTALL指令查看檔案內容。

Installation instructions:

1. Edit the Makefile for your OS.  Comment out the Linux options and un-comment
   the options for your OS.
2. Type: make
3. Type: make install
4. Enjoy colorful directory trees.

  I cannot test on non-Linux machines, so please feel free to contribute
porting information, bug reports, compile options, patches, etc for porting to
other OS's to ice@mama.indstate.edu.

  I would also welcome any localization efforts, particularly translating the
man page to other languages.  And of course feel free to suggest options and
improvements you would like to see in tree.


五、在第一點的說明中指出,修改Macfile,註解掉Linux defaults的項目部份,並且解除你作業系統的選項。

六、執行make,即可進行編譯囉,您的系統應該要安裝XCode。

make
sudo make install


七、由於Mac OS 10.11後有一個rootless的基制,您可以嚐試用sudo make install,如果不行安裝
請參考我的另一篇文章: https://www.ccc.tc/notes/1
或是我們簡單的將編譯好的tree檔拷貝到/usr/local/bin底下即可。
cp tree /usr/local/bin

這樣就完成tree指令的編譯與安裝囉。

 

Tags: MacOS

Devin Yang

文章內容無法一一說明,如果您有什麼不了解處,歡迎提問哦:)

No Comment

Post your comment

需要登入才可留言!

類似的文章


macos

關於MacOS上的ditto指令

ditto指令第一次出現在Mac OS X (10.0)在一些狀況下,他比cp指令直覺還好用,有興趣的人可自行研究測試。假定我的目錄下有個envs資料夾,我的測試如下:

vim, macos

Ultisnips requires py >= 2.7 or py3 問題修正

如果你跟我一樣安裝Vim,執行terminal是否會出現需要python2.7或python3的錯誤,但是系統明明就有python 2.7呀, 本文說明我如何修正此問題。

cli,linux,macos

如何用find刪除建立時間為準的舊檔案

這功能很好用,但要很小心,先看再刪,弄錯目錄會死很慘