>Starting with 4 virtual cores and 8 GB vRAM, where the VM ran perfectly briskly with around 5 GB of memory used, I stepped down to 3 cores and 6 GB, to discover that memory usage fell to 3.9 GB and everything worked well. With just 2 cores and 4 GB of memory only 3.1 GB of that was used, and the VM continued to handle those lightweight tasks normally.<p>Good reminder that there's a certain amount of memory tied up with each core (probably mainly page cache and concurrency handling etc).
As a general rule, also the amount of physical memory installed in a computer should be proportional with the number of hardware threads provided by its CPU.<p>Besides the fact that the operating system may allocate some memory for each thread, when you launch a multi-threaded application that is able to use all available threads, for instance the compilation of a big software project, it frequently will allocate some working memory in an amount proportional with the amount of working threads.<p>I have encountered many multi-threaded applications that need up to 2 GB per thread to work well.<p>This corresponds to having 64 GB for a desktop CPU with 32 threads, like Ryzen 9 9950X.<p>For the compilation example, I have seen software projects, like Chrome/Chromium and its derivatives, where if you do not have enough memory, proportional to the number of hardware threads, e.g. when you have only 32 GB for a 16 core/32 thread CPU, you must reduce the number of concurrent compilations, e.g. with an appropriate parameter to "make -j", leaving some threads and cores idle, because otherwise you may encounter out-of-memory errors.
Compiling flash-attn (Flash Attention) is a another great stress-test for CPU+RAM as just using 16 threads can balloon you into 128GB RAM usage territory already. Same thing with needing to not do too much concurrency when compiling it.
Yes! I have also observed that with compilation VMs on a big server.
I'd bet for the null hypothesis: the memory behaviour changes would hold if the core count was kept constant and only the VM's memory size was adjusted.
Agreed. This is the OS adapting to available memory.<p>Similarly if you started with 4GB and there was 900MB available for user apps, I expect you could launch apps that consume 1500MB just fine; the OS is leaving enough to launch anything, and making use of unused memory for cache/etc.
There is a per-cpu data structure in the xnu kernel, but it is not big enough to tilt the scales when you are talking about RAM in units of gigabytes.
There is some overhead per-core, you're right, but imo this reduction in usage is likely from how the kernel allocates available memory, which is being reduced as well. The kernel will keep read caches around longer with more memory, it'll prefer to compress memory instead of swap to disk if it has more, it'll purge/cleanup reclaimable memory less often with more memory, etc. It even scales its internal buffer sizes and vnode tables depending on total memory.<p>All good things imo, it dynamically makes the most of what is available, at the expense of making it harder to see a true baseline of hard min requirement to operate.<p>Fun things to check, `vm_stat`<p>$ vm_stat
Mach Virtual Memory Statistics: (page size of 4096 bytes)<p>Pages free: 230295.<p>Pages active: 1206857.<p>Pages inactive: 1206361.<p>Pages speculative: 31863.<p>Pages throttled: 0.<p>Pages wired down: 470093.<p>Pages purgeable: 18894.<p>"Translation faults": 21635255.<p>Pages copy-on-write: 1590349.<p>Pages zero filled: 11093310.<p>Pages reactivated: 15580.<p>Pages purged: 50928.<p>File-backed pages: 689378.<p>Anonymous pages: 1755703.<p>Pages stored in compressor: 0.<p>Pages occupied by compressor: 0.<p>Decompressions: 0.<p>Compressions: 0.<p>Pageins: 832529.<p>Pageouts: 225.<p>Swapins: 0.<p>Swapouts: 0.<p>edit: no code fence markdown support or am I doing something wrong?
Single inline backticks like `this` aren't recognized (although still useful in my opinion, they just don't change the rendering).<p>Triple backticks also aren't recognized. However, if you indent by I believe 4 spaces, it formats it in a fixed width font presuming it's code.<p>Let's try (4 spaces):<p><pre><code> func main() {
fmt.Println("Hello, HN!")
}
</code></pre>
None for comparison:<p>func main() {
fmt.Println("Hello, HN!")
}
Got a M5 air recently - my first dive into MacOS land so trying to figure this out too.<p>Seems essentially impossible to get:<p>* pytorch<p>* GPU acceleration<p>* VM/container like isolation<p>The virtio-gpu layer gets closest but seems to only pass through graphics GPU not compute GPU so no pytorch
I need this too, and looked quite a lot on it a year ago. I haven’t had time to check out the recent developments with Docker Model Runner (vllm-metal) or podman libkrun. Did neither of those work for you?
I got torch to run in a Cirruslabs Tart instance.
[dead]
My only experience with VMs on macOS is colima+docker, and it's relatively painful and inefficient (but usable).
Try Apple's container CLI. I moved a project of mine from colima+docker to it relatively easily, a couple of weekends ago.<p><a href="https://github.com/apple/container" rel="nofollow">https://github.com/apple/container</a>
Here's an example of how to build a simple Alpine Linux container using Apple's containerization CLI. It also demonstrates how to connect to the container through Tailscale SSH using a Tailscale auth key stored in Apple Keychain:<p><a href="https://github.com/highpost/tailscale-macos-container" rel="nofollow">https://github.com/highpost/tailscale-macos-container</a>
Does this project aim for docker cli and api compatibility? Searching for Docker on that page yields no results. Though in their example, they do show an example of a Dockerfile referencing docker.io without shame.<p>Typical Apple behavior, I guess, but grating to see in a OSS tool.
AFAIK no support for Compose though
I'm curious to know what kind of project is macOS exclusive?
container is really good, ive been using it to sandbox some CLI tools and it starts up in less than a second
Thank you for this, will check it out!
Recently got a Mac Mini for local CI purposes (together with Forgejo Actions), took a broad look at the ecosystem and decided to just roll with "build on host" instead. Setting up signing/notarization just looked like an insurmountably task together with isolating it from the host, even with agents. At least the macOS builds are really fast now and the signing/notarization just ~200 lines of Bash...
> the signing/notarization just ~200 lines of Bash<p>200 lines?! That’s two orders of magnitude too many. What exactly are you doing that you need so such code for signing and notarisation?
From the top of my head, unlocking the keychain, finding the right identity, notarizing two parts, the binary itself and the .dmg that the .app ships in and some other stuff I'm sure. Can do a deeper look in a bit when I can. Most of the hassle is because it's 100% unattended and I had to do stuff to avoid GUI-prompts for passwords/unlocks, and that the Forgejo Runner has a different security context.
Could you share your recipe please ? I’m interested
OrbStack is pretty good. I don't find it inefficient, really.
<a href="https://github.com/trycua/cua/tree/main/libs/lume" rel="nofollow">https://github.com/trycua/cua/tree/main/libs/lume</a> had a interesting take on this.
I think I got the smallest:<p><pre><code> $ podman image list | grep cross
docker.io/gotson/crossbuild latest d96ea9b7054b 3 years ago 6.71 GB
</code></pre>
used to cross-build to darwin.
> Starting with 4 virtual cores and 8 GB vRAM, where the VM ran perfectly briskly with around 5 GB of memory used<p>But... if you start applications inside your VM it will want the full 8 Gb you've allocated not the 5 Gb it uses at startup?
Honestly macOS probably can go much lower than that if you turn off some stuff that's not strictly necessary for a VM. The first iPhones only had 128 MiB of RAM and they ran a trimmed down version of macOS Tiger I believe. It's just that RAM has been quite abundant so far, so there was no real reason to try to trim it down, but it's definitely possible, and probably not that hard either, we just need to start trying again :)
Is is possible to run macos on pc? Or at least dev in some way on PC for the mac.
Kind of a random question, but would it be feasible to intune enroll a macOS VM as a personal device?
I am so curious why no one make an env for agent specfic for macOS. Like the agent spawn in mac env
I was hoping to see the bare macOS with all the applications removed as much as possible, no graphical user interface, just the bare minimum to boot, login as a user, and write hello world dot txt with a text editor. Or maybe some command line apps? Or is it no longer macOS at that point?
You can boot regular macOS directly to a root terminal in “Single User Mode”. This was easier on Intel macs of yore but is also possible on M1+<p>Below content from <a href="https://eclecticlight.co/2020/11/28/startup-modes-for-m1-macs/#comment-56556" rel="nofollow">https://eclecticlight.co/2020/11/28/startup-modes-for-m1-mac...</a><p>Launch 1 True Recovery, open Terminal, then run “bputil -a” (without the quotes) to downgrade system security and allow for more boot arguments. You might need to restart after this step.<p>Then, run [nvram boot-args=”-s”] (without the square brackets). Restart to launch Single User Mode.<p>Once in Single User Mode, run these commands (in the following order) to mount the root volume group:<p>1. mount -P 1<p>2. /usr/libexec/init_data_protection<p>3. mount -P 2<p>Future restarts will always launch Single User Mode first. To stop launching Single User Mode, run [nvram boot-args=“”] (without the square brackets).<p>To restore your system to full security, run “bputil -f” (without the quotes). If you choose to run that command in macOS, prefix “sudo” to the beginning.
"I'd just like to interject for a moment. What you're referring to as macOS, is in fact, macOS/Darwin, or as I've recently taken to calling it, macOS plus Darwin."<p>"What you're referring to as Darwin, is in fact, Darwin/XNU."<p>"What you're referring to as XNU, is in fact, BSD/Mach."<p>I seem to remember it being possible to run macOS-less Darwin several years ago, not sure if that's still possible or if Apple has modified it so much at this point that it's useless without at least some macOS components.
> <i>several years ago</i><p>2024, maybe? needs some renewed interest perhaps:<p><a href="https://www.puredarwin.org/" rel="nofollow">https://www.puredarwin.org/</a>
<a href="https://github.com/apple/darwin-xnu" rel="nofollow">https://github.com/apple/darwin-xnu</a><p>Apple stopped updating this 5 years ago.<p>I remember getting it to boot once long ago but I didn't have anything to actually do with it.
"We might hope that macOS would process AI tasks using the CPU and GPU rather than the neural engine, when running in a VM."<p>That specific Geekbench test is to measure the ANE performance, which they did by setting the CoreML run to cpuAndNeuralEngine. They could have set it to all and it would use any hardware available, but that would be counterproductive to a test that hopes to measure the ANE, no?<p>And note that there is no "just ANE" option. In this case it is probably the virtualized CPU side of the equation that's yielding the massive slowdowns for int8 and quantized runs.<p>The ANE isn't the problem here.<p><a href="https://dennisforbes.ca/blog/microblog/2026/02/apple-neural-engine-and-you/" rel="nofollow">https://dennisforbes.ca/blog/microblog/2026/02/apple-neural-...</a>
I'm wondering if the Xcode simulator (without Xcode running) performs as well, my 2020 Intel MacBook Air has been incapable of running Safari in iOS smoothly for nearly all its life.
Macbook Neo should run rings around any Intel Air: Geekbench shows it at 250% the score of 2020 Intel Air.<p><a href="https://browser.geekbench.com/v6/cpu/compare/17022784?baseline=17843430" rel="nofollow">https://browser.geekbench.com/v6/cpu/compare/17022784?baseli...</a>
My M1 Air, which was my personal Mac, generally stomped my work MBP 2019 with an Intel chip.<p>The difference between the absolutely silent M1 and the hairdryer Intel was staggering.<p>I’m sure you’re completely right.
You’re going to love that newfangled M1 chip.
[dead]
[dead]
[dead]
[dead]