How to Install Magic Mirror on Your Raspberry Pi

Zach Zach (248)
30 minutes

Magic Mirror is essentially a webpage that runs on a web server housed inside your Raspberry Pi. It displays tons of cool information and can even be used to create your very own smart mirror!

Note: I recommend using either the Raspberry Pi 4 or 3 to complete this project, but the Raspberry 2/Zero/Zero W will also work.

MicroSD card reader ×1
Raspberry Pi power supply, 2A ×1
Raspberry PiRaspberry Pi ×1
MicroSD card, 32GB ×1
Raspberry Pi 3 case ×1
HDMI cable ×1
USB Mouse ×1

Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.

First, you'll need to install the latest version of Raspberry Pi OS (formerly Raspbian), the official Raspberry Pi operating system (based on Debian Linux). Check out our guide for Raspberry Pi OS installation instructions.

Unmount the SD card from your computer and insert it into your Pi. Connect your keyboard, mouse, HDMI cable and, lastly, the Pi's power cable. You will now see the Raspberry Pi OS desktop (GUI).

Our Magic Mirror needs to be wifi-enabled so that it can connect to the internet and so that we can access it remotely to set things up.

In the top right of your screen, click on the network icon (two computers with an X). Select your network, enter your wifi password, and click OK.

The Raspberry Pi 3 and Raspberry Pi Zero W have built-in wifi, older Pis (and the normal Pi Zero) do not. If you're using a Pi without built-in wifi, you'll need to connect a wifi dongle to your Raspberry Pi.

We'll need our Pi's IP so that we can connect to it from our regular computer and complete the rest of the installation from there.

On your Pi, navigate to Menu > Accessories > Terminal. Type the following and press enter:


Your Pi's IP will be located next to inet addr.

Alternatively, you can also ping your Pi from your computer to obtain the IP address; I wrote a short guide on pinging the Raspberry Pi.

On newer versions of Raspberry Pi OS, SSH is disabled by default. You can either enable SSH using the SD card or, on your Pi, navigate to Preferences > Raspberry Pi Configuration > Interfaces and enable it there.

After enabling SSH, open Terminal (Mac) or Command Prompt (Windows). Type the following command and press enter:

ssh pi@your-pis-ip-address

When prompted for your password, use the default Raspberry Pi password: raspberry. If you see an authenticity of host warning, type yes and press enter.

Change the default password For better security, I recommend you change you Pi's default password to something else. Type the following, press enter, and follow the prompts:


Expand your Pi's filesystem to utilize all available space, and also to boot into the GUI Type the following and press enter:

sudo raspi-config

Select Expand Filesystem and press enter. Then, reboot your Pi:

sudo reboot

Update your Pi

sudo apt-get update
sudo apt-get upgrade --yes

There are a number of great Magic Mirror dashboards available -- I went with one created by Michael Teeuw since it's beautiful and he's a bit of a Magic Mirror pioneer. More information for the MagicMirror dashboard can be found on its Github repo.

We're going to use the automatic installer to save us some time. To do this, run the following command:

bash -c "$(curl -sL"

Note: The automatic installer officially supports the Pi 2, 3, and 4. If you want to run MagicMirror on a Pi 1 or Pi Zero, you'll need to use the server-only version and install a full-screen browser manually. Save yourself some time and just use a Pi 3. :)

When prompted whether you want to use pm2 for auto starting of your MagicMirror, select "yes" by typing y and pressing enter.

MagicMirror should start automatically! If it doesn't, run:

cd ~/MagicMirror && DISPLAY=:0 npm start

Now we'll tell MagicMirror to start on system boot. While connected to your Pi, run the following command:

pm2 startup

That command will output another command for you to run. Run that command. It may vary for your system, but for me it was:

sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u pi --hp /home/pi

Next, create a startup shell script:

cd ~

Add the following to that file, save, and exit:

cd ~/MagicMirror
DISPLAY=:0 npm start

Make sure the script is executable:

chmod +x

Next, start MagicMirror and force it to start on boot:

pm2 start

Finally, reboot your Pi:

sudo reboot

If your magic mirror needs to be in portrait mode (as mine is), you'll need to rotate your Raspberry Pi display:

sudo nano /boot/config.txt

Add the following lines:

# rotate the screen
display_rotate=1 # use lcd_rotate=3 to rotate in the other direction

To keep your Pi from going into sleep mode (which defeats the purpose of the magic mirror), run the following:

sudo nano ~/.config/lxsession/LXDE-pi/autostart

Add the following, save, exit, and reboot:

@xset s 0 0
@xset s noblank
@xset s noexpose
@xset dpms 0 0 0

If you'd like to save electricity, you can also add a PIR sensor to your Raspberry Pi and install the MagicMirror PIR module to wake your mirror when it senses motion. :)

Customize the interface

Time to configure the interface for your location and needs!

cd ~/MagicMirror
nano config/config.js

Configure weather Change both the "currentweather" and "weatherforecast" weather module settings to your location.

Change the JavaScript config object to add your city's name, location ID, and free OpenWeatherMap API key:

config: {
    location: "Tampa",
    locationID: "4174757",
    units: "imperial" // Use Fahrenheit instead of Celsius

Configure compliments MagicMirror spins through an array of complements based on the time of day. If you'd like, you can change these compliments to something different -- famous quotes, perhaps?

Configure your calendar By default, MagicMirror shows a calendar containing US holidays. You can change these by pasting a calendar's public URL here.

For now, I decided to remove both and instead subscribe to the Tampa Bay Rays schedule and a Google Calendar containing a list of national holidays. These calendar URLs normally end in .ics, and you can Google the one you're looking for.

Down the road, I'll add authentication so I can link up my Google Calendar. You can also change the icon that's loaded by changing the value of calendar.urls.symbol; this value should be from the list of FontAwesome icons found here, with the "fa-" portion removed. For example, 'fa-bullhorn' becomes just 'bullhorn'.

When you're finished configuring, save and exit.

There are tons of other fun and useful MagicMirror modules you can play around with. Find a really great one? Post in the comments section below and I'll include it here!

Now that your MagicMirror setup is working, I highly recommend you create a backup of your SD card image. This is totally optional, but if something gets messed up when installing Jasper it will be easy to revert. I wrote a guide on how to back up your SD card for Mac or, if you have Windows, Lifehacker wrote a great guide as well.

Make your magic mirror voice-enabled by installing Google Assistant. Be sure to check out my Google Home-enabled magic mirror guide to learn how to do this.

Jasper is an open-source text-to-speech and speech-to-text processing platform, allowing you to speak commands to your Raspberry Pi such as to play a Spotify playlist, add things to your Google Calendar, or integrate with openHAB to control your entire house. Jasper is definitely a cool feature to add to your mirror -- if you're up for the task!

I wrote an exhaustive guide on how to install Jasper on your Pi. You can also see my completed Magic Mirror build here, which is a great read if you're also into woodworking.

The Raspberry Pi can be a complicated beast. Post below and I'll do my best to help you out!

Zach Zach (248)
15 minutes

This guide will show you how to use an Amazon Dash Button to restart or shut down your Raspberry Pi.