How to run Raspberry Pi Desktop on Windows or macOS

How to run Raspberry Pi Desktop on Windows or macOS

Our articles usually show you how to do things on a Raspberry Pi. This time, we’re changing things up: we’re going to show you how to use a PC or Mac to run the Raspberry Pi Foundation’s desktop operating system, Debian with Raspberry Pi Desktop (for brevity’s sake, we’ll call it just “Raspberry Pi Desktop” from now on). This Raspbian-like OS (as the names imply, both operating systems are based on Debian) allows you to use your PC or Mac as a kind of substitute for your Raspberry Pi. That makes it useful for testing out projects when your Pi isn’t handy. It’s also fun because it backs the familiar Raspbian interface with your PC or Mac’s hardware, which is much more powerful than the little Pi.

The simplest way to get Raspberry Pi Desktop up and running is to install the operating system, but that will require you to dedicate a computer to the project (or at least to partition a hard drive). If you want to keep running Windows or macOS on your computer, your best bet is to run Raspberry Pi Desktop on a virtual machine – which is exactly what we’ll show you how to do in this guide.


How to run Raspberry Pi Desktop on Windows or macOS

Step 1: Download and install VirtualBox

Because we’re going to run Raspberry Pi Desktop on a virtual machine, we’ll need to download Oracle VM VirtualBox. In Oracle’s own words, “VirtualBox is a powerful x86 and AMD64/Intel64 virtualization product for enterprise as well as home use.”

You can download the software from VirtualBox’s Downloads page. Just choose the right version for your operation system (there are two: a Windows version and a macOS version). After you’ve downloaded the executable, install VirtualBox by following the installation wizard’s instructions.


Step 2: Download Debian with Raspberry Pi Desktop

Next, you’ll need to download the image file of Raspberry Pi Desktop from the Raspberry Pi Foundation’s site.


Step 3: Launch VirtualBox and create a new virtual machine

Now that we’ve both VirtualBox and Raspberry Pi Desktop downloaded, we’re ready to launch VirtualBox and create a new virtual machine.

Click “New,” and you should see a screen like this:

Create Virtual Machine

We don’t want to create a Windows virtual machine, of course, so let’s change the settings a bit. First, choose a descriptive name for your virtual machine (for example, “Raspberry Pi”), then select Linux from the Type dropdown menu and Debian (64-bit) from the Version dropdown menu. After that, click Next.

On the next screen, you can use the recommended memory size of 1024 MB – this corresponds to the Raspberry Pi 3’s memory size.

The next screen is about adding a hard disk to your new virtual machine. Just click Create, unless you have some reason to modify the settings. Then, click Next on this screen and again on the next.

Finally, you can choose the size of your hard disk. We used the recommended size of 8 GB, but you may want to have a larger hard disk. When you’re ready, click Create.

Now we have the settings of our virtual machine in place.


Step 4: Install Raspberry Pi Desktop

Click Start to start the installation of Raspberry Pi Desktop. You should see a screen like this:

Select start-up disk

Browse to the folder where you saved the image file of Raspberry Pi Desktop, select the file, and click Start. What you should see next is a menu titled “Debian GNU/Linux installer boot menu.” Use the arrow keys – or i – and Enter to select Install.

On the next screen, select your preferred keyboard layout and continue by pressing Enter.

Choose Guided – use the entire disk and keep pressing Enter to Select disk to partition and choose the Partitioning scheme. Finally, Finish partitioning and write changes to disk.

You might want to grab a cup of coffee or tea while the system is installing.

After a while, the installation wizard prompt you: “Install the GRYB boot loader to the master boot record?” Select Yes, and choose /dev/sda.

When the installation wizard has installed everything, you should see a screen like this:

Raspberry Pi Desktop

Look familiar? If you’ve used Raspbian before, it should!


Step 5: Make the virtual machine interactive

Our virtual machine is successfully running Raspberry Desktop now, but the screen size is a bit small, and it doesn’t get bigger when you click Maximize. We can make our machine more interactive by installing VirtualBox Guest Additions. Guest Additions makes it possible for us to resize the screen, use the clipboard, and share files between our PC or Mac and the virtual machine.

To do this, first open Terminal and make sure that your system is up to date:

sudo apt-get update
sudo apt-get upgrade

You’ll have to type the commands because our virtual machine isn’t very cooperative, yet.

Now we’re ready to install VirtualBox Guest Additions:

sudo apt-get install linux-headers-$(uname -r) virtualbox-guest-dkms virtualbox-guest-x11

With Guest Extensions installed, click on the Devices menu and select Shared Clipboard > Bidirectional.

If you rebooted your virtual machine now, you would be able to use the same clipboard on both your PC or Mac and the virtual machine. You would also be able to resize the screen. But let’s not reboot, yet. Instead, let’s first to add our user to the vboxsf group to enable file sharing between the virtual machine and PC or Mac:

sudo adduser pi vboxsf

Now we’re ready to shut down our virtual machine and set up a shared folder. This the shutdown command:

shutdown -h now


Step 6: Set up a shared folder

To set up a shared folder, right-click on your virtual machines name and select Settings…, or press Ctrl+S with your virtual machine selected.

From the menu that opens, select Shared Folders.

Click the button with the green plus sign that adds a new shared folder.

From the Folder Path dropdown many, select Other… and then the folder you’d like to share. When you’re ready, click OK and check Auto-mount.

Add Share

If you start your virtual machine again and launch the file manager, you should see your shared folder with the prefix “sf_” in the /media directory. Any file you put in that folder will also show up in the corresponding folder in/on your PC or Mac, and vice versa.

And that’s it! You now have Raspberry Pi Desktop running on a virtual machine on your PC or Mac, and you can easily use the clipboard and manage folders while you’re working on your next project.

14 Comments on "How to run Raspberry Pi Desktop on Windows or macOS"

  1. Sorry – relative beginner here.

    Can I run it from a 32 GB USB3 memory stick?

    My MacBook’s HDD is rather full and I keep getting ‘HDD space is low’ messages.

    • You can run it from a USB stick. When you are asked to create a virtual hard drive, just change the location.

      (Also, he didn’t mention it, but there are significant performance benefits to using a fixed-size hard drive rather than a dynamically allocated one. When asked to create a virtual hard drive, just select ‘Fixed’. It will take longer to create but be quicker to use.)

  2. Luiz Renato Lopes | October 22, 2017 at 3:16 pm | Reply

    How can I change the screen resolution of Raspian in the virtual machine? I have tried many things but I did not succeed. Although I can maximize the screen, the resolution is very small. When I use Raspberry Pi the resolution is much better.

  3. Outstanding. Thanks for the hard work to create one simple VB process that works perfectly.

  4. I have installed The Pi with the VirtualBox on my iMac (macOS High Sierra). The PI is working great with one exception. I don’t get clear with Step 6: Set up a shared folder. When I do exactly as written no shared folder with prefix “sf_” is showing up. Do I missing something?

  5. Running a RPi VM, then I change RPi System Configuration (e.g. keyboard, locale…) and I also “apt-get update/upgrade”. At restart all preferences and settings are lost: it appeared that the changes are not stored between restarts. I tried to find appropriate options but without success.

    Any clue?

  6. I’m trying to install virtualbox guest additions, but after I entered the first line and press enter, it always says
    “e: unable to locate package virtualbox-guest-dkms”

    What should I do? Thanks!

  7. If you have problems installing the guest-additions:

    “In Raspbian Stretch (late 2017 onwards), the VirtualBox Guest Extensions are no longer in the standard Raspbian repositories. You need to enable the Debian Backports repsitory. To do this, you will also need to install the Debian authentication keys. Type in the following. Press Enter at the end of each line.

    sudo apt update
    sudo apt install -y dirmngr
    sudo apt-key adv –keyserver –recv-key 8B48AD6246925553
    sudo apt-key adv –keyserver –recv-key 7638D0442B90D010
    echo “deb stretch-backports main contrib non-free” \
    | sudo tee /etc/apt/sources.list.d/backports.list
    sudo chmod 644 /etc/apt/sources.list.d/backports.list


  8. This works for me until the following:

    sudo apt-get install linux-headers-$(uname -r) virtualbox-guest-dkms virtualbox-guest-x11

    Like the previous commenter, I get an error message for this. It’s annoying as you cannot resize the screen – it’s tiny.

  9. As per previous comment by MJ – “e:unable to locate package virtualbox-guest-dkms” everything up to there went perfectly…

  10. I’ve had a similar experience to Jan Kromhout with regard to Step 6: Set up a shared folder. When I do exactly as written, no shared folder with prefix “sf_” is showing up in the file manager /media directory or anywhere else. Does anyone know a fix? Thanks!

Leave a comment

Your email address will not be published.