UTM - Run Ubuntu Virtual Machine on Mac

This blog is a step by step guide on how to run a Ubuntu (Linux) Virtual Machine on MacOS using UTM (Open Source Virtual Machine Tool). Also the settings needed to share Clipboard and Directory between Ubuntu and MacOS.

Download UTM

Download and Install UTM application on MacOS from

Download Ubuntu ISO file

Download Intel or AMD 64-bit architecture Ubuntu LTS iso file from

Create Ubuntu Virtual Machine

  1. Open UTM
  2. File Menu -> New
  3. Select Virtualize
  4. Select Linux
  5. Set Memory as 12288 MiB
  6. Set CPU Cores as 3 or higher
  7. Check Enable display output
  8. Uncheck Enable hardware OpenGL acceleration
  9. Click Continue
  10. Uncheck Use Apple Virtualization
  11. Select Boot Image Type as Boot from ISO image
  12. Click Browse and select the download Ubuntu LTS iso image
  13. Click Continue
  14. Set size of the drive as 64 GiB or higher
  15. Click Continue
  16. Do not set any shared directory at this point, we will setup the shared directory once Ubuntu installation is completed. Skip this step for now and click Continue
  17. In Summary, set Name as Ubuntu-Linux

Install Ubuntu

  1. Click the Play button next to Ubuntu-Linux to begin installation
  2. Using Keyboard, select Try or Install Ubuntu option and press Enter key
  3. Choose Language as English and click Next
  4. Skip Accessibility and click Next
  5. Select keyboard layout as English (UK) or English (US) or Indian and click Next
  6. For Internet, select Use wired connection
  7. Skip Update and click Next
  8. Select Install Ubuntu and click Next
  9. Select Interactive Install and click Next
  10. Select Extended selection and click Next
  11. Check Install third party software
  12. Check Install support for additional media formats
  13. Click Next
  14. Select Erase disk and install Ubuntu
  15. Click Next
  16. Set Your Name as ubuntu
  17. Set Computer Name as ubuntu-utm
  18. Set Your username as ubuntu
  19. Type password and confirm password
  20. Check Require my password to log in
  21. Uncheck use active directory
  22. Click Next
  23. Select your timezone and Click Next
  24. Click Install
  25. Once installation is complete, click Restart now
  26. When you see the message 'Please remove the installation medium', click 'Drive image options' icon on the top right corner, then hover on 'CD/DVD' and select 'Eject'. And then press Enter key
  27. Now the installation is complete and wait for the restart

Change Ubuntu Settings

The following settings or changes are optional, but doing it makes the experience with Ubuntu smoother
  1. Show Apps -> Settings -> Mouse & Touchpad:
  2. Uncheck Mouse Acceleration
  3. Set Scroll Direction as Natural
  4. Show Apps -> Settings -> System -> Date & Time -> Clock & Calendar:
  5. Check Seconds
  6. Show Apps -> Settings -> Ubuntu Desktop
  7. Uncheck Show Home Folder
  8. In Dock -> Show on, select All displays

Clipboard and Directory Sharing

The following settings or changes are very important to enable clipboard and directory sharing between Ubuntu and MacOS
  1. Show Apps -> Terminal and execute sudo apt install spice-vdagent spice-webdavd
  2. After installing the packages Power Off Ubuntu Machine
  3. In the UTM app, right click Ubuntu-Linux and select Edit
  4. Go to sharing secting
  5. Tick Enable clipboard sharing
  6. Set Directory Share Mode as 'SPICE WebDAV'
  7. Click Browse and choose any directory (eg Downloads) on MacOS
  8. Untick Read Only
  9. Click Save
  10. Start Ubuntu-Linux
Access the shared directory in browser at http://127.0.0.1:9843/
Or by executing the command in terminal
firefox http://127.0.0.1:9843/

Connect the shared directory in Files explorer
Files -> + Other Locations -> Click Enter server address (input box at the bottom) and type
dav//127.0.0.1:9843
Click Connect

Access the shared directory in Terminal by navigating to
cd /run/user/$UID/gvfs/dav:host=127.0.0.1,port=9843,ssl=false

Access the shared directory in Filex explored by running the command
open /run/user/$UID/gvfs/dav:host=127.0.0.1,port=9843,ssl=false

Adding multiple displays

Perform the following steps to add additional displays (monitor) for Ubuntu
  1. In the UTM app, right click Ubuntu-Linux and select Edit
  2. Click + New option and select Display
  3. Click the newly created Display section
  4. Select Emulated Display Card as virtio-gpu-pci
  5. Tick Resize display to window size automatically
  6. Click Save
  7. Restart the Ubuntu-Linux vm to see the addtional display (monitor)

Comments

Popular posts from this blog

Export/Backup Ollama Model

JSON with curl and jq

Import self signed in Linux for Chrome / Chromium headless testing