CLOC - Count Lines of Code on Mac

  1. Download the cloc-1.62.pl, rename it to cloc.pl then copy it.
  2. Open ‘finder’ and browse to usr/local/bin on your Mac partition
    paste it there
  3. 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"
    fi
  4. Save it as ‘cloc’ [without extension] on same folder [/usr/local/bin]

  5. Ppen ‘terminal’ from ‘applications’
  6. Browse to the folder by typing ‘cd /usr/local/bin’
  7. Type the following ‘chmod +x cloc’ in order to give permission for the file
  8. We made to execute using cloc is so easy now, you only need to open terminal and type ‘cloc /path/to/your/project/‘.

screenshot:
image

Refer to: http://me.syrex.me/2011/10/cloc-count-lines-of-code-on-mac.html