We Rebuilt the Linux MicroVM Stack on Apple Silicon

(encore.dev)

86 points | by signa11 4 hours ago ago

41 comments

  • dolmen 2 hours ago

    What an awful blog renderer that, in Firefox, works when scrolling with the trackpad, but doesn't work when using keyboard arrow keys or pageUp/down: I get blank pages when scrolling with the keyboard beyond the initial viewport.

    • fg137 18 minutes ago

      I never understand why people mess with layout/scroll bar in this way. Like, now you have got more things to maintain.

    • hibbelig an hour ago

      Oh yes. I discovered that there are two scrollbars. By clicking somewhere in the blog text, you activate the inner one and then scrolling with the keyboard works.

    • andout_ 2 hours ago

      Sorry about that - just pushed a fix :)

      • bheadmaster 28 minutes ago

        Are there any technical reasons to override native scrolling functionality in the first place?

    • bartvk 2 hours ago

      I thought it was just me. Super weird.

    • klausa 2 hours ago

      Wow, that's actually an impressive new failure mode; and it happens on Safari too.

  • bittermandel 2 hours ago

    By experience, getting Firecracker to run well on M-series macs is quite the undertaking. I'm not at all surprised Encore decided to take this path considering their customer base!

    At Lovable we decided to spend ~1 engineering month getting our sandbox infrastructure to be 100% runnable on Mac and on Linux with predictable builds using Bazel etc.

    But we actively decided to take a different route than Encore and run nested virtualization, which on macOS means vfkit -> QEMU -> Kind + Firecracker vm(s). It's been invaluable to get the same development and testing tools on both platforms tbh.

  • huerne 3 hours ago

    VZ.framework is very limited, Hypervisor.framework is the better analogue to KVM

    • jdub 3 hours ago

      Virtualization.framework isn't particularly limited, for what it is... given they're using Firecracker on Linux, it makes sense to use a similarly high level API on macOS.

      (One could add a Hypervisor.framework backend to Firecracker, though I'd be surprised if AWS accepted it.)

  • kombine 3 hours ago

    > most engineers at Encore develop on a Mac

    They are solving the wrong problem.

    • UqWBcuFx6NV4r 2 hours ago

      Hacker News is so utterly detached from reality at times, and comments like these really drive that home.

    • rob_c 3 hours ago

      No, they're realists.

      Plus show me an off the shelf solution to MDM that exists in the Linux space? (Not too mention an easy to buy consumer devices which supports suspend/resume correctly in 2026, not even Windows can do that any more)

      Apple is crap and evil about many things, but at least here they know their paying audience...

      • mhast 3 hours ago

        One case where Apple can be very useful is if you're traveling a lot for work.

        Wherever you are you can probably find a local store that sells and services Macbooks. So if your machine is damaged during a trip you can get it fixed, or buy a replacement on the spot, and at least get through the work you are there to do.

        For small-ish companies that can be a very useful feature.

        • elAhmo 2 hours ago

          Buying on the spot - sure. Anything that requires repair has to be usually booked in advance with some waiting time. Relatively short, usually days, but still not really possible to go into the store and get your laptop fixed right away in most cases.

          • dijit 2 hours ago

            If you have a business relationship with Apple, it's same-day service.

            You don't even have to be a large corp for that, my org was 60 people with like 20 Macbooks and we had it.

            FWIW if you live in a major metro area, Dell also does this, it's not terribly uncommon for business class machines.

          • superb_dev 2 hours ago

            The wait can be pretty short, I once got the charging port on my iPhone replaced same day at an Apple Store in Vegas

        • ErroneousBosh 2 hours ago

          Why wouldn't you do that with any other platform?

          Buy any laptop, stick Linux on it, get working.

          Buy a cheap shitty Chromebook, ssh to your dev platform, give it to some school child who doesn't have a laptop when you get your real one back.

          You don't need to be locked into Apple's ecosystem for that.

          • dofm an hour ago

            > Buy any laptop, stick Linux on it, get working.

            Except it's still a slightly different challenge each time to "get it working", each different PC. A Mac is a Mac is a Mac, more or less.

            I have a nice Framework laptop on my desk running Kubuntu alongside my Macs. Every now and then I check in, make sure I could switch to it if I needed to, test all my important tasks, plug it in so the stupid mainboard battery does not go flat.

            And then I go back to my Mac, because I prefer it and even Tahoe isn't painful enough to switch. KDE is fine and I'll use it if circumstances dictate I have to.

            I think critics misunderstand the extent to which Mac-using devs are "locked into Apple's ecosystem". Unless you're writing iOS apps, you aren't. You perhaps even exist in a more heterogeneous world (Mac and Linux, Mac and Windows, all three) than a Linux-using web dev does.

            Essentially everything I run is not at all "locked in". I would miss the ease of keychain, handoff and Apple Notes (which I like despite its flaws). I would miss a few specific things (handoff, keychain, Apple Notes on my desktop) and then I'd deal with it. I'd probably carry on using an iPhone (I am very ambivalent about the iPad)

            FWIW my "Apple ecosystem" is why I have been able to teach myself open weights/open source AI at a pragmatic level, because my secondhand off-the-shelf kit does an acceptable job of it without me yet having to specify a PC I don't have enough use for as a non-gamer. A lot of people have solved a lot of general problems that I don't have to tinker with too early.

            This isn't a fanboy thing (I would consider myself a qualified critic). Both KDE and GNOME have some nice things. It's just a question of energies.

            IIRC it was Adrian Cockcroft who said he used Sun at work, and a Mac at home, because performance tuning was his day job and he didn't want to do it at home; I think this resonates.

            It has been my own choice for 28 years, largely; Mac plus linux.

      • asdf88990 2 hours ago

        Lots of Lenavo laptops do just fine, but Apple hardware is still supreme for what it is worth.

      • MadsRC 2 hours ago

        FleetDM comes to mind

      • esseph an hour ago

        > MDM Linux

        Jumpcloud, I've used it across Windows / Mac / Linux end user desktops and laptop fleets.

        https://jumpcloud.com/lp/cross-os-device-management-fava-bea...

  • pranav_tech26 2 hours ago

    Rebuilding MicroVMs natively on Apple Silicon usually cuts virtualization overhead massively, but Hypervisor.framework DX and virtio device parity are the real bottlenecks.

  • arpitaks an hour ago

    Very hard to read

    • ricardobeat 3 minutes ago

      Agreed. Pacing is off. It feels like AI wrote it, then they did another round of AI to change the tone and light edits.

  • andout_ 2 hours ago

    Hey everyone - author of the article here! Happy to take questions.

    • bojangleslover an hour ago

      This is unbelievably cool. How did you use AI for this? Absolutely not suggesting there's anything wrong with it - quite the contrary. I find AI is most useful for these lower level driver type projects such as yours that one knows are possible but that would be very onerous for a human to implement. For example the guy who re-wrote a driver from scratch for his HP Printer the other day.

      Do you think you could have done this without AI? I've been migrating people off of AWS recently and it was absolutely made possible (or at least expedient) by AI.

  • bit_rot73 3 hours ago

    Four years on a shared remote machine before building the local backend is a good lesson in when to invest in dev tooling versus living with the workaround.

  • techpression 2 hours ago

    I think Encore is great and do really cool things, but this post is AI;DR from the first sentence.

  • github_vibe 3 hours ago

    I just encountered the `com.apple.private.virtualization` entitlement limitation just last night, wanting to use VZVirtualMachine private AccessorEndpoint api. There's lot of useful stuff hidden in Apple's Private API space.

    Great write up! I enjoy seeing others working in the same problem space.

  • bomewish an hour ago

    This seems great tech but the obvious obvious LLM slop writing is just so incredibly off-putting. We read LLM slop everyday ourselves, but now we have to read it everywhere else too. Is this stuff so hard to just write oneself ??

  • jiqiren 2 hours ago

    "You can even get /dev/kvm inside a Linux VM on an M3 or later running macOS 15, which runs Firecracker unmodified."

    I'm very confused why any SWE is on a M1 or M2 Mac. I've always gotten a new machine at $CORP every 2 years...

    • isodev 2 hours ago

      Because prices? Have you seen how much Apple products cost these days?

      Also, M1/M2 are perfectly fine and capable hardware. It's hard to justify the upgrade outside some artificial constraints Apple would bring in with a macOS update.

    • twalla 2 hours ago

      You’d be surprised. I got an absolute boat anchor of a 2019 MacBook when I started a job in early 2022. I requested a new one in late 2023 because company policy is to refresh laptops every 4 years - whoever was on the other end of my support ticket interpreted the policy as four years from issuance and denied me.

    • dijit 2 hours ago

      it's pretty common to be running a 4 year old computer in most companies I've worked.

      I think they plan for 3 years but in reality it becomes closer to 4 (because they don't plan the refresh during the actual hardware refresh cycle, so you'll end up with a computer that was released in September the year before in like August the year after).

      I've never worked anywhere that replaced my computer after 2 years.

    • jml78 2 hours ago

      I am on an M1 macbook pro. My company will upgrade me anytime I want.

      I haven’t asked because my current laptop is more than ok.

    • jonathanlydall 2 hours ago

      I'm very surprised you feel it's a given that every SWE at every company has the perk of getting a new machine as quickly as every 2 years, I doubt it's justified by the productivity increases of just 2 years of hardware improvements.

    • ChrisRR an hour ago

      Sounds extremely wasteful to me. What's a new machine going to offer than a 2 year old machine doesn't?

    • nxc18 2 hours ago

      Things were painful in the Intel era but I’m on M1 Mac and I’d have a really hard time justifying a request for an upgrade. I absolutely detested my old Intel MacBook (touchbar era) and couldn’t wait to get rid of it.

      I run bloated slow electron apps and chrome all day, generally with profligate usage patterns, and things hardly ever slow down even with corporate antimalware. Sometimes I forget about having left Windows VMs running in the background.

      Anyway, why would my company spend $2500+ every two years to turn instant into instant?