3 ms·
Development on Apple Silicon with UTM
- robin_reala 2y agoNot sure why this recommends emulation instead of installing the native ARM images referenced near the top of the page?
- twarge 2y agoIndeed, and here are a large variety of OSs directly from the source: https://mac.getutm.app/gallery/ https://mac.getutm.app/gallery/
- misja111 2y agoYeah I was wondering too. The big advantage of UTM, apart from that it's free, is IMO that it can run natively on Apple ARM cpu's.
- pmarreck 2y agoA lot of dev tooling still expects x86_64. Example off the top of my head, Cosmopolitan will not build ARM binaries and will not compile on ARM. (But it WILL build x86_64 universal binaries that will run on Apple Silicon and macOS via Rosetta.) There is also the issue of wanting to have your dev environment be as close to your prod environment as possible, and the vast majority of cloud-based hosting is still x86_64.
- commandersaki 2y agoWith virtualisation you can use Rosetta 2 for Linux to run x86_64 binaries. That's what I do and it's more efficient.
- chatmasta 2y agoUTM uses Rosetta via qemu. It’s the most direct way of emulating x86 on Apple Silicon, using native Apple emulation layer.
- ndiddy 2y agoThen you're emulating everything that runs in the VM, as opposed to using an ARM vm and only emulating the x86 program you want to run. This makes things a lot slower.
- deleted 2y ago[deleted]
- chatmasta 2y agoThat’s a good point… but does Rosetta in a Linux VM somehow use the native MacOS hypervisor? I would like to see a benchmark of these various methods…
- commandersaki 2y agoI don't know how Rosetta 2 for Linux is implemented in Virtualization.Framework - but it exposes it via a mountpoint on the (ARM) Linux VM. The binfmt executable that is exposed essentially does what Rosetta 2 does but for a Linux binary. I think the binfmt executable can be used outside of Virtualization.Framework and can even be used in an ARM VM in say Asahi but people don't because it's not easy to do but also honour system as it's not licensed for use outside of MacOS.
- commandersaki 2y agoYou can't do Rosetta 2 for Linux thru qemu as qemu doesn't use Virtualization.Framework. UTM does support virtualisation via VF.
- dijit 2y agoI really like UTM, I especially like UTM remote on the iPad. The issue is that of course Apple computers that are large enough to run VMs are… expensive. So I have instead found myself using proxmox on a cheaper (by comparison) threadripper machine. The added bonus is that xterm.js (the default LXC console viewer) works wonderfully on the iPad- Though of course you can use prompt3 for heavier duty stuff. The other uses I have for VMs on the mac is Docker and Kubernetes, but those are solved by colima and minikube respectively.
- runeks 2y ago> The issue is that of course Apple computers that are large enough to run VMs are… expensive. Expensive compared to what? UTM uses Apple Virtualization Framework, which lets the guest VM only occupy as much memory as it's actually using (instead of reserving all of its available memory). This means it's viable to run a Linux VM on e.g. an 8GB RAM MacBook Air.
- dijit 2y agoHow can I verify that? it definitely looks in htop and Activity Monitor that the RAM is occupied and unavailable. Maybe memory compression helps, but it doesn’t appear so to me right now.
- runeks 2y ago> How can I verify that? Good question. I was speaking from memory, and all I can find when googling is this: https://docs.getutm.app/settings-apple/virtualization/#balloon-device https://docs.getutm.app/settings-apple/virtualization/#ballo... EDIT: I recall vaguely something about it being a problem with Linux guest VMs because it aggressively uses RAM as a file system cache. So it'll just fill up RAM to the max when reading from disk, and overwrite this if it's later needed by applications.
- dijit 2y agoballoon memory is supported by qemu on linux too.
- trollied 2y agoOr you could just follow the guide on the UTM site & use the installer. https://docs.getutm.app/guides/ubuntu/ https://docs.getutm.app/guides/ubuntu/
- sks147 2y agoI use multipass for ubuntu https://themythicalengineer.com/how-to-install-ubuntu-on-mac-using-multipass-and-use-vscode-remote-access.html https://themythicalengineer.com/how-to-install-ubuntu-on-mac...
- rcarmo 2y agoI moved from that to Colima and never really looked back.
- thinker5555 2y agoMaybe I'm just really out of my depth on this, but it feels like there's not a lot of information about _why_ these particular steps and tools are used. Why are 4 different Linux images needed? Why are there all of these steps to create a one-time use "init.iso"? Is it just so the cloud-init script can run? I see the call to mkisofs is referencing "cidata", but it's the only place in the whole page that "cidata" shows up. Does that mean mkisofs is cloud-init aware? And why use emulation instead of virtualization? I guess part of why I'm asking is because I've set up virtual machines in UTM on Apple Silicon before, and I never had to go through all of this just to get Linux installed and configured. The post makes me wonder if there's something I'm maybe missing, but it doesn't give any explanation for me to be able to figure out if that's the case. Maybe the post is meant more just as a checklist for the person that wrote it, for their own reference? But the way the post reads doesn't quite sound that way. Hmm... that's all coming out sounding more critical than I mean to. I just want more info and I am curious about the approach.
- larusso 2y agoMy thought was why use UTM? Most of this can be achieved with qemu alone :). But it showed me something new. The cloud init tool was new to me. From my toolbox I would have used ansible or something. But I think it very interesting that this runs all automatically during first boot. But I agree one needs to read between the lines to understand what the purpose of this post is. As you said it reads like a overcomplicated install setup.
- znpy 2y ago> My thought was why use UTM? Most of this can be achieved with qemu alone :) qemu needs to be studied a bit, UTM is fairly intuitive. I recently decided to learn how to create VMs with bare qemu (using the command-line). As I have an arm macbook for work, UTM helped me a ton with aarch64 virtual machines because I could enable debug log and see what qemu options/flags/switches would UTM use. Unrelated: I have some ideas about writing a tool that aims at being a "spiritual successor" to vagrant (from hashicorp), but focused on targeting qemu rather than virtual box. Anyone interested? Please let me know (upvote or comment)
- sorenbs 2y agoI've had a really good time using https://github.com/lima-vm/lima https://github.com/lima-vm/lima
- twsted 2y agoI also suggest https://github.com/abiosoft/colima https://github.com/abiosoft/colima for containers, "Containers on Lima"
- commandersaki 2y agoBig fan. I will say Orbstack is superior - and can be more performant with mountpoints but colima does pretty much everything I need and is FOSS.
- vbezhenar 2y agoThe most severe limitation that I've found is inability to work both with x86 (Rosetta) and USB passsthrough. qemu does not support Rosetta and Virtualization.Framework does not support USB passthrough. In the end, I abandoned Macbook and moved to Thinkpad because of that.
- jbverschoor 2y agoAlthough I would'e loved to use UTM, it's still a resource hog. OrbStack (machines) does such a great job at being lightweight. Is it already possible to connect an external screen to UTM and use that as the main screen? (Multi-port Adapter or iOS, or a displaylink usb dongle on Macbook). That would enable some great stuff. Until then, I don't think the overhead is worth it for me
- rafram 2y agoUTM is OK for light workloads, but if you can justify the cost of Parallels, you’ll be far better off using that.
- runeks 2y agoI hate most things about Parallels. I spun up a Windows VM using Parallels for work purposes, and it decided to change from using native Chrome to open html files to using Edge in the Windows VM. So double-clicking a html file would first start the Windows VM, if it wasn't already started, and then open it in Edge inside the VM. WTF is wrong with you Parallels?
- xz18r 2y agoI work at the company selling Parallels and I let one of the PMs know of your concern; this is his reply: "Parallels doesn't change the file associations. Parallels registers Windows apps (like Edge) for macOS in case users want to open them/files using macOS interface. macOS then decides what apps to use for this or that file type or protocol. Based on our testing if there is already a file association, then a new app registered in the system doesn't change it. Tip: Parallels provides an option to disable sharing Windows apps with macOS. It is enabled by default as the vast majority of customers like it. File associations can also be changed anytime using "Get Info" in file context menu and then "Open with:" and "Change All..."." In other words, it looks like .html files were associated to your (in-Windows) Edge, hence it booting up a VM etc. but that can easily be mitigated.
- nottorp 2y agoHmm I haven't tried x86 linux on utm on an arm mac (i have an x86 linux box i can ssh in), but i tried x86 windows. It was so slow as to be unusable. Edit: would command line linux be usable, considering it doesn't have to emulate all those pixels?
- runeks 2y agoAn x86 Linux VM on an ARM Mac is roughly native speed because it can utilize Rosetta 2: https://docs.getutm.app/advanced/rosetta/ https://docs.getutm.app/advanced/rosetta/
- nottorp 2y agoAhh. Thanks, I didn't know that. Looks like you need to install an arm distro and x86_64 binaries on top of it though. May be a lot of trouble in some cases.
- weitzj 2y agoLove it. Also using UTM with Amazon Linux 2023 x64 on an M1 works, so you can create a local HashiCorp Packer Pipeline using the Packer UTM plugin (similar to the QEMU Packer plugin) source "utm-cloud" "this" { iso_url = "${path.root}/dev_images/al2023-kvm-2023.6.20250303.0-kernel-6.1-x86_64.xfs.gpt.qcow2" iso_checksum = "sha256:0dc2797fe19847f6c75878dd344ab478ac0657077d9a15f2907bb2df41d8c3de" vm_arch = "x86_64" cpus = 2 memory = 4096 display_nopause = true boot_nopause = true export_nopause = true skip_nat_mapping = true communicator = "ssh" ssh_clear_authorized_keys = true ssh_private_key_file = data.sshkey.this.private_key_path ssh_host = "192.168.64.100" ssh_port = 22 ssh_username = "ec2-user" shutdown_command = "echo 'packer' | sudo -S /sbin/halt -h -p" use_cd = true cd_label = "cidata" cd_content = { "meta-data" = <<EOF local-hostname: vm-hostname EOF "user-data" = <<EOF #cloud-config ssh_sftp: enabled: true password: ec2-user ssh_pwauth: True chpasswd: expire: False users: - default - name: ec2-user lock_passwd: false plain_text_passwd: ec2-user ssh_authorized_keys: - ${data.sshkey.this.public_key} EOF "network-config" = <<EOF #cloud-config version: 2 ethernets: enp0s1: # dhcp4: yes addresses: - 192.168.64.100/24 gateway4: 192.168.64.1 nameservers: addresses: - 10.0.2.2 enp0s2: dhcp4: no state: down EOF } }
- deleted 2y ago[deleted]
- teeray 2y agoI’n about to embark on my first Apple Silicon machine tomorrow, and UTM is a core part of my plans for it. The difference from TFA, for me, is that I already have some mature Nix flakes for doing development in WSL that I’ve built up over the last year. If I can’t have that environment bake a VM for me wholesale, it’s probably a short `nixos-rebuild switch --flake` away.
- rcarmo 2y agoKeep Colima on your radar. Best way to run Docker on a Mac, IMHO.
- elchiapp 2y agoHas anyone tried emulating linux/amd64 on Silicon with GPU support? I'm testing an engine to run LLMs locally that only runs on that, no support for arm.
- treesknees 2y agoUTM is great when you’re using native ARM versions of Linux or Windows. Where it (or QEMU) is absolutely terrible is trying to emulate x86 for working on legacy apps or for retro computing. For example, try installing a Windows 2000 vm. It won’t even get past the initial setup screen because it runs so slowly. My saving grace has been that Windows 11 ARM also has its own x86 translation layer, so I can still run many (but not all) 32bit windows apps. But it’s been frustrating having such a powerful machine that can’t run an x86 vm.
- cosmic_cheese 2y agoWINE also runs under Rosetta and can handle 32-bit apps, which can help improve x86 32-bit Windows app coverage. Not everything runs well under it but it has settings for which version of Windows it simulates which allows it to run some things that 11 can’t.
- JSR_FDED 2y agoFor a quick Linux VM on an Apple Silicon Mac I’ve had great results with Tart. Drop dead simple. X86 binaries run at full speed due to Rosetta.
- anpep 2y agoEver since I discovered OrbStack, my M1 has become the perfect laptop for me. OrbStack has great UX, massive FS performance, Docker & Kubernetes support, and a bunch of really clever people behind it. Everyone doing linux development on a Mac should try it
- asadalt 2y agooh wow. i hadn’t hesrd if orbstack. i am sick of docker issues on my og m1.
- corv 2y agoIt's really good but the fs caching has bit me a couple times before I realized what was going on.
- oulipo 2y agoCan you tell more about this?
- oulipo 2y agoOrbstack is great! I'm wondering why there is not an open-source equivalent? Did they have to reimplement a lot of the native calls to make it work fast enough?
- eddyg 2y agoWhat are the real-world benefits over Colima?⁽¹⁾ (Besides having a GUI, which I can do without.) I'm interested in an up-to-date comparison when running the VM with Rosetta 2: colima start --vm-type=vz --vz-rosetta ⁽¹⁾ https://github.com/abiosoft/colima https://github.com/abiosoft/colima Edit to add: While researching OrbStack, I found this comment in a post from 7 months ago that mirrors a lot about my experience with Colima: https://news.ycombinator.com/item?id=41424044 https://news.ycombinator.com/item?id=41424044
- rcarmo 2y agoI use Colima as well. Haven’t found anything that works better, TBH.
- goranmoomin 2y agoFrom the title, I hoped so much that this was about using UTM on Apple Silicon iPads – don’t really want the person who always complains about Apple, but it’s really a pity that the iPad has such a strong CPU inside (I own an M4 iPad Pro) and can’t do any realistic development on it. Last time I checked, there really isn’t any way to virtualize ARM machines on the iPad with UTM (unless you’re on a lower iOS version), and emulating x86_64 machines were slow enough (even on M4 iPads) and not really usable. I’m on an environment where iPads are fine but equivalent MacBooks aren’t (stupid rules), and got this machine for hope that I might tinker development with iPads, but I gave up running stuff locally and just boot up an EC2 instance whenever I really want to do something. It’s a pity. (BTW, from the article, why would anyone really emulate a Linux machine with UTM on Apple Silicon? From my experience ARM64 Linux images are really good at compatibility…)
- SSLy 2y agoThe fault here is Apple having exclusive access to JIT, UTM on iPadOS/iOS can't fix that.
- goranmoomin 2y agoYeah it’s pretty unfortunate that such capabilities are locked to special entitlements.
- threecheese 2y agoThe docs for UTM seem to indicate that jailbreaking or sideloading is required, and with my current reliance on the Apple stack (macs, HomePods, tv etc) I really worry about getting my account banned - even though I’d only ever use this for development. Is this an unreasonable fear?
- voxic11 2y agoUTM requires jailbreaking/sideloading to install on iOS because it violates App Store policies so it can't be distributed via the App Store. On macOS the Mac App Store has much less restrictive policies so UTM is actually approved to be installed via the Mac App Store. https://apps.apple.com/us/app/utm-virtual-machines/id1538878817 https://apps.apple.com/us/app/utm-virtual-machines/id1538878... Also macOS allows you to install and run applications which aren't approved by the Mac App Store. So using UTM as described in the article doesn't violate any Apple policies.
- deleted 2y ago[deleted]
- rcarmo 2y agoUTM is the one thing I wish I could run on my iPad - with a JIT or proper virtualization (right now you can only run UTM SE with very slow and battery draining emulation).
- commandersaki 2y agoUTM is such a high quality mac app, up there with Preview.app. I use the free version distributed via homebrew. But if you find the software useful, highly recommend you either pay for it via mac app store or donate which can be done via github sponsors.