Installing Magic Mirror² on a Raspberry Pi Zero
The MagicMirror² platform isn’t designed to run on a Raspberry Pi Zero out of the box, but it’s definitely possible to get it working. I’ve used it on one of my Magic Mirrors in the past. It did take some tinkering, and wasn’t as easy as the 5 minute setup is, but it’s not an unmountable task! So here’s how to do it.
This guide will only look at how to install the platform onto the Pi, so I if you haven’t already set up an OS on the Pi, connected it to Wifi, etc, please go through steps one to five steps in this guide, and then come back to finish here.
1. Install Node.js
start by opening up Terminal (if you’re on a Mac) or Command Prompt (Windows) and connect to the Pi through SSH (replace the part after @ with the correct IP address:
Type in the password when prompted, the default is raspberry.
Install Node.js by copying and pasting or typing each code snippet line below one by one:
tar -xvf node-v4.4.5-linux-armv6l.tar.gz
sudo cp -R * /usr/local/
2. Install NPM & Git
After the Pi has booted up again, connect to it again via SSH and install NPM and Git by putting in the following commands one by one:
sudo apt install npm
sudo apt install git
go back to the home folder by typing cd
3. Install the latest Magic Mirror repo and a lot of other stuff
git clone https://github.com/MichMich/MagicMirror
Go into the magic mirror folder and install Magic Mirror. This step will take a long time, be prepared to wait for at least 15-20 minutes. Just be patient!
sudo npm install
Next you have to install a browser. The browser that’s recommended is called Midori. Type in the following command:
sudo apt-get install midori
Installing the Midori browser will take some time as well, so just sit back and see what’s happening on Reddit or something!
Next you have to set up AutoLogin on the raspberry pi. If you didn’t the pi would stop booting up until you’d type in a password.
Go to Boot Options, then B1 Desktop/CLI and B2 Console Autologin and enable it.
Now Install xinit, a program that allows you to manually start a display server:
sudo apt-get install xinit
Install Xorg, which is a display server:
sudo apt install xorg
Now Install matchbox, a window manager for Linux:
sudo apt install matchbox
Since you’re making a Magic Mirror, you don’t want the cursor to be visible. To hide it, install Unclutter:
sudo apt install unclutter
Now you’re nearing the end. Make two script files, to autostart the Magic Mirror on boot.
First make a script called mmstart.sh. This script will start the MagicMirror platform as well as xserver/midori on startup
sudo vim mmstart.sh
Put the following code into the file, and save it:
node serveronly &
sudo xinit /home/pi/midori_start.sh
Now make a script called start_midori.sh. This script will start the xserver display server and the midori browser.
sudo vim midori_start.sh
Put the following into the file and save it:
xset -dpms # disable DPMS (Energy Star) features.
xset s off # disable screen saver
xset s noblank # don’t blank the video device
midori -e Fullscreen -a http://localhost:8080
Finally, make both scripts you just created executable
$ sudo chmod a+x mmstart.sh
$ sudo chmod a+x midori_start.sh
Your Magic Mirror should be ready to go by now. But, there are quirks that make it more difficult to run MM on a Pi Zero.
Someone suggested running the npm install command again inside the MagicMirror folder, so try that if you can’t get it working.