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

需要登入才可留言!

类似文章


vpn,cli,macos

我如何在MacOS上用命令行拨VPN

我自己会有用MacOS在命令行拨VPN的需求,在这提供我的别名,设置方式

macos

关於MacOS上的ditto命令

ditto命令第一次出现在Mac OS X (10.0)在一些状况下,他比cp命令直觉还好用,有兴趣的人可自行研究测试。假定我的目录下有个envs数据夹,我的测试如下: