Urgent.News

What's breaking now, across thousands of outlets.

Tech

Putting Apple's Virtualization framework under a Flutter app

I maintain WSL Manager , a Flutter desktop app from 2021 that saves you from typing wsl.exe flags. Version 2 runs the same app on Apple silicon, where it manages native Linux and macOS VMs through Apple's Virtualization framework. This post is about what that took. Almost none of it was in the Flutter part. Install on macOS with brew install --cask wsl-manager . The macOS side is still beta. The…

The WSL Manager is a Flutter desktop application released in 2021, aiming to simplify the process of managing WSL (Windows Subsystem for Linux) environments. Version 2 of the app extends its capabilities to run on Apple silicon devices, offering management of both native Linux and macOS virtual machines through Apple's Virtualization framework. This article delves into the technical aspects of implementing this feature.

The macOS version of WSL Manager relies heavily on a Swift helper called vmctl, which runs independently from the Flutter application. vmctl is a command-line interface (CLI) that communicates with the Flutter app through JSON output. The app maintains separate directories for each VM, containing configuration files, disk images, EFI variables, cloud-init seed images, and log files. A common backend interface and capabilities record allow the Flutter codebase to support both WSL and Apple VMs.

To keep the virtual machine running after a command finishes, vmctl starts a detached copy of itself (named vmctl__run) and waits for a five-second timeout, allowing for error handling if the configuration is broken. The VM remains headless, with its process ending once the command returns. A headless NSApplication handles termination signals, such as SIGTERM for a graceful shutdown and SIGUSR1 for opening the VM's graphical interface.

Each VM is equipped with a virtio graphics device from the start, even if the VM is headless. The cloud-init process writes to the root password hash, preventing it from locking the account. The cloud-init document is merged with the user-data during the setup process. The host network interface is integrated into the VM, with the IP address determined by parsing macOS's DHCP lease information.

To connect to the VM's console, vmctl uses a Unix socket and executes the SSH command as a child process, ensuring a responsive serial console experience. The serial log aids in troubleshooting boot failures, and the app handles various edge cases, such as qemu-img dependencies, ext4 file system limitations, and UI integration for managing distros and VMs.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

A 4 GB Laptop GPU Beats a 12-Core CPU by 4.3x on Gemma 4

This article compares two ways of serving the same small language model on the same laptop: CPU-only, and on the 4 GB GTX 1650 Ti sitting in the same chassis.

  • Laptop GPU outperforms 12-core CPU by 4.3x on Gemma 4 model
  • 3.35 GB quantization-aware GGUF model served on both CPU and GPU
  • GPU memory holds 1598 MiB of model's 3.334 GB tensor bytes

Learn PostgreSQL extensions through a gloriously bad idea: MM/DD/YYYY

This project teaches four of PostgreSQL's most powerful features by building something no sane person would ship: extensions — how you add new capabilities to PostgreSQL in C, expression indexes — how…

  • Create expression index for MM/DD/YYYY dates
  • Define custom type with operators for partial date searches
  • Use GiST index for efficient month, day, year component queries

More from Wednesday 16 September →