How to record video stream with VLC on OSX? The recommended Linux/Windows way is to use command line:

cvlc --run-time=5 --sout file/ts:stream.mp4 htsp://@ip:5050


I would like to do the same on OSX, but it doesn't have command line. I tried the same, but replaced cvlc with /Applications/VLC.app/Contents/MacOS/VLC, but it doesn't work:

filesystem access error: cannot open file /Applications/VLC.app/Contents/MacOS/rtp://@ip:5050
I would avoid VLC if you want to record streams off the Internet.  After many months of trying to figure it out, it came down to an issue with with their codec not working propertly via command line.
However, because of this problem, I found a better solution (it works with audio and video):
FFmpeg
It's a command line tool and is the source of the libraries that other app developers use (like Handbrake).  It's available as a source or binary - whichever you are more comfortable with (I personally recommend the binary).
The command to record a stream is is actually very simple:
ffmpeg INPUT [options] OUTPUT [options] 

For example, if I wanted to record a streaming video for the next hour and place it on my Desktop:
ffmpeg http://foo.bar/stream -t 3600 ~/Desktop/foo_bar_stream_mp4

For more info, see the full documentation.