- Download the cloc-1.62.pl, rename it to cloc.pl then copy it.
- Open ‘finder’ and browse to usr/local/bin on your Mac partition
paste it there In your favorite editor make new text file and paste the following:
1
2
3
4
5
6#!/bin/bash
if [ "$1" == "/" ]; then
echo "wrong input, cloc can't work on."
else
perl /usr/local/bin/cloc.pl "$1"
fiSave it as ‘cloc’ [without extension] on same folder [/usr/local/bin]
- Ppen ‘terminal’ from ‘applications’
- Browse to the folder by typing ‘cd /usr/local/bin’
- Type the following ‘chmod +x cloc’ in order to give permission for the file
- We made to execute using cloc is so easy now, you only need to open terminal and type ‘cloc /path/to/your/project/‘.
screenshot:
Refer to: http://me.syrex.me/2011/10/cloc-count-lines-of-code-on-mac.html