Saturday, February 25, 2012

How to install the command tree for mac

To install, download the source code and extract the tarball like so:
curl -O ftp://mama.indstate.edu/linux/tree/tree-1.5.3.tgz
tar xzvf tree-1.5.3.tgz
cd tree-1.5.3/
ls -al

Now you have to change Makefile to match your environment. If you’re using Linux,you can probably skip this step. If not, simply uncomment the lines for your operating system and comment out all the others. For example, if you’re using Mac OS X, do the following: 

open Makefile : vim Makefile
  1. Comment out the following lines so they look like this:
    # Linux defaults:
    #CFLAGS=-ggdb -Wall -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
    #CFLAGS=-O2 -Wall -fomit-frame-pointer -DLINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
    #LDFLAGS=-s
  2. Uncomment these lines, like so:
    # Uncomment for OS X:
    CC=cc
    CFLAGS=-O2 -Wall -fomit-frame-pointer -no-cpp-precomp
    LDFLAGS=
    XOBJS=strverscmp.o
INSTALL
als:~ als$ curl -O ftp://mama.indstate.edu/linux/tree/tree-1.5.3.tgz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 34494  100 34494    0     0   8055      0  0:00:04  0:00:04 --:--:-- 32388
als:~ als$ tar xzvf tree-1.5.3.tgz 
x tree-1.5.3/CHANGES
x tree-1.5.3/INSTALL
x tree-1.5.3/LICENSE
x tree-1.5.3/Makefile
x tree-1.5.3/README
x tree-1.5.3/tree.c
x tree-1.5.3/strverscmp.c
x tree-1.5.3/man/tree.1
x tree-1.5.3/man/tree.1.fr
als:~ als$ cd tree-1.5.3
als:tree-1.5.3 als$ ls -al
total 208
drwxr-xr-x  10 als  staff    340 25 Fev 22:37 .
drwxr-xr-x+ 47 als  staff   1598 25 Fev 22:37 ..
-rw-r--r--   1 als  staff   6772 19 Out  2009 CHANGES
-rw-r--r--   1 als  staff    362 27 Ago  2008 INSTALL
-rw-r--r--   1 als  staff  18009 12 Ago  2004 LICENSE
-rw-r--r--   1 als  staff   2089 19 Out  2009 Makefile
-rw-r--r--   1 als  staff   4167 19 Out  2009 README
drwxr-xr-x   4 als  staff    136 25 Fev 22:37 man
-rw-r--r--   1 als  staff   5322 27 Ago  2008 strverscmp.c
-rw-r--r--   1 als  staff  52732 24 Nov  2009 tree.c
als:tree-1.5.3 als$ vim Makefile 
 Make changes to the Makefile according to your system operability.
 Commenting on the lines that are not in their system.

als:tree-1.5.3 als$ sudo make install
cc -O2 -Wall -fomit-frame-pointer -no-cpp-precomp   -c -o strverscmp.o strverscmp.c
cc  -o tree tree.o strverscmp.o
install -d /usr/bin
install -d /usr/man/man1
if [ -e tree ]; then \
install -s tree /usr/bin/tree; \
fi
install man/tree.1 /usr/man/man1/tree.1
als:tree-1.5.3 als$ tree 
.
├── CHANGES
├── INSTALL
├── LICENSE
├── Makefile
├── README
├── man
│   ├── tree.1
│   └── tree.1.fr
├── strverscmp.c
├── strverscmp.o
├── tree
├── tree.c
└── tree.o


1 directory, 12 files



0 comentários:

Post a Comment