Skip to content

July 18, 2014

Count Number of Source Lines of Your Code on OSX

by noise

If you want to find the number of lines of source code for your project you can install a small app from Mac Ports:

sudo port install SLOCCount

Then go to the root directory of your project and run sloccount.

For example:

sloccount ClientStackOfStrings/

The output would be:

SLOC	Directory	SLOC-by-Language (Sorted)
63      ClientStackOfStrings objc=63
0       ClientStackOfStrings.xcodeproj (none)
Totals grouped by language (dominant language first):
objc:            63 (100.00%)
Total Physical Source Lines of Code (SLOC)                = 63
Development Effort Estimate, Person-Years (Person-Months) = 0.01 (0.13)
 (Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months)                         = 0.10 (1.16)
 (Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule)  = 0.11
Total Estimated Cost to Develop                           = $ 1,482
 (average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Read more from Documentation

Leave a Reply


Note: HTML is allowed. Your email address will never be published.

Subscribe to comments