OSX has a command line port scanner. It’s just super sekrit is all. The questionably named stroke command, is part of Network Utility, which is nestled in your Utilities folder. Normally it’s only exposed through Network Utility’s GUI, but there is a way to get at it from your command prompt.
First, create a link to stroke, preferably somewhere in your $PATH.
ian@mymac:~$ ln /Applications/Utilities/Network\ Utility.app/Contents/Resources/stroke stroke
Next make it executable, if it isn’t already.
ian@mymac:~$ chmod uo+x stroke
Now let’s do a port scan. We will scan the localhost, ports 49152 thru 65535.
ian@mymac:~$ ./stroke 127.0.0.1 49152 65535