OSX: using CLI version of VLC
How can I use the CLI version of the VLC on OSX?
After installing VLC on OSX, it works fine through the normal GUI process, spotlight, etc. Also, I know it's possible to do
open bla.avi -a vlc
However, when I issue vlc
command in the shell, it doesn't work. which vlc
in shell doesn't return anything either.
CLI version of VLC is very handy for transcoding, streaming, etc. So it would be nice to have it working.
Solution 1:
The command open bla.avi -a vlc
works because OS X is using its Launch Services database to open the application VLC. This doesn't have anything to do with a command line binary of the same name, which isn't installed by default.
The binary you search for is in the VLC.app
package, so you can type that into a terminal:
/Applications/VLC.app/Contents/MacOS/VLC -I rc
This will open the interactive command line VLC. Or, execute the following in order to have the above line registered as an alias to vlc
:
echo "alias vlc='/Applications/VLC.app/Contents/MacOS/VLC -I rc'" >> ~/.bash_profile
Once you've added this, you need to restart your Terminal. Now type vlc
and you'll get to the command line.
If you don't like the interactive interface or would like to use VLC
with other options, you need to edit your ~/.bash_profile
accordingly, e.g. through open -e ~/.bash_profile
.
Solution 2:
OS X applications don't usually install any program executables outside their application bundle. As you don't usually interact with them from the command line, they're not put into any folder on your PATH
.
If you installed VLC to /Applications
, the actual executable is /Applications/VLC.app/Contents/MacOS/VLC
.
/Applications/VLC.app/Contents/MacOS/VLC -h
will show some help, and /Applications/VLC.app/Contents/MacOS/VLC --intf ncurses
will launch the ncurses UI.
Solution 3:
To access vlc
from the command line, you can create a local symbolic link as below:
mkdir ~/bin
ln -vs /Applications/VLC.app/Contents/MacOS/VLC ~/bin/vlc
To have this command available for all users, you may want to link it into /usr/local/bin
instead.
Make sure that your ~/bin
(or /usr/local/bin
) is in your environmental PATH
variable, in other words that your ~/.profile
file contains something like:
# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
PATH="$HOME/bin:$PATH"
fi
Above code is default behaviour on Linux.