by Devin Yang

建立於: 8年前 ( 更新: 2年前 )

前言

相信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

需要登入才可留言!

類似的文章


linux,macos

ps aux你會了嗎?

對於Linux的系統管理者來說肯定要看懂ps aux指令,如果你想成為一個Linux系統管理者,或是你是一個Linux的使用者,都應該都要看的懂這個指令ps就是process status的簡稱,系統上跑了什麼樣的程式,狀態如何執行的身份是誰都可以透過這個指令查出來。看到一些不該出現的程式,可能系統被入侵,被來挖礦了🥹

vim, macos

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

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

macos

macOS上的say指令語音清單

如何在macOS上的終端機說國語,或是廣東話呢? 點進來看看