Installing castnow

Wanted to stream videos from the Raspberry Pi to my Chromecast and control it on the command line through ssh.  Found out about a cli tool that does just that.  It’s called castnow and it was quite a beast figuring out how to install it, so I’ve boiled it down here.

# It’s actually not a regular program you can just download with apt-get.  It runs on nodejs.

So here’s the install breakdown:

Pre-install flight check:

sudo apt-get update -y

sudo apt-get install wget

# Update and install wget if not already installed.


Install nodejs:


tar -zxvf node-v0.10.28-linux-arm-pi.tar.gz && cd node-v0.10.28-linux-arm-pi/bin

This downloads an archive of nodejs version 0.10.28 and extracts it.

sudo su


apt-get install npm

npm install -g castnow

Change to root and add this path so that castnow will be able to run as a regular command once it’s installed.  Install npm, the nodejs package manager.  Then use npm to install castnow.

su pi

sudo ln -s “$(which nodejs)” /usr/bin/node

Change back to the pi user and make a symbolic link to the node directory in /usr/bin.

There’s a few cool things you can do with castnow.

  • Play local .mp4 video files.

castnow ./video.mp4

  • Play video and / or audio files from a directory.

castnow ./Media/

  • Play multiple videos in a row.

castnow episode1.mp4 episode2.mp4 episode3.mp4

There’s many more commands and options to play with, more information can be found on castnow’s github:


Simple Automation Scripts

Making a script to automate a few commands is actually pretty easy, but seemed really daunting on the first few attempts.

Here is a breakdown to create a simple script, make it executable and run it.  Once you get the hang of this you can create your own customized scripts.


Create a new file with the .sh extension.  While the extension is not necessary for the script to run, it helps you know it’s a script when looking at the file in the directory listing using ls.


This is the first line of the script that tells bash “hey, this is a script!”

# Start Automation Script

Adding comments like this helps to keep track of what the script is doing.

echo “This is an automation script!”

Here’s an example of a command that can be run, really any command run in the terminal can be put into this kind of script.

Your script file should look like this when editing in nano.


# Start Automation Script

echo “This is an automation script!”

Exit and save the file with Ctrl x, confirm you want to save with y and press enter.

chmod +x

Modify the permissions to make the script executable.


Run the script.  This command will run the script but make sure you’re in the same directory as the script.