Archive for the ‘osx’ Category

VMs on M1

Monday, December 27th, 2021

I have upgraded my laptop. It’s been a while (Mid 2014) and I felt like the new MacBook Pro is finally a computer I can use a while. It’s got an SD card slot, an HDMI port, MagSafe and enough USB ports (even though they are all USB-C). What I’m missing is an easy way to connect my old displayport screen, but I’ll fix that by upgrading that as well (it’s ~10 years old).

The machine is great – the screen, the silence even when under load, the fingerprint reader, I love it all. I have not had any issues with the apps due to it being Apple Silicon. What I have noticed is that some smaller utility apps I used have disappeared since I last did a fresh install – developers moved on, decided to not support the new platform or the new APIs. I have mostly1 found replacements, even if some are paid apps.

Reasoning

On my previous laptop I had all development stuff running directly on the Mac. This was a problem every time I upgraded the OS as random things would die and fixing them took a lot of time. So this time around I want to pack all my development stuff inside a linux VM that would then hold either code directly or docker containers.

My initial idea was to set up an x86_64 virtual machine, so that I could have an environment as close to what I normally use in production, but installing it in UTM took forever, so I abandoned that idea for now.

Software

Step one was setting up some virtual machines to test how that would work.

I have previously used VirtualBox, but they have not yet decided to support the M1, so what I found and tested was:

  1. UTM,
  2. Parallels Desktop for M1 and
  3. VMWare Fusion for Apple Silicon.

So I went about installing Ubuntu in all three environments. My source image was Ubuntu 20.04.3 LTS, the machines set up as arm with 8GB of RAM and 4 cores. In the case of UTM, the system is set to QEMU 5.0 ARM VM (virt-5.0)2 with CPU set to cortex-a72 and Force Multicore checked.

Shared directory

After installing I looked at how I can share a directory from the host inside the VM:

  1. UTM

    I haven’t figured it out yet as it wanted me to install something on my Mac, so I gave up (for now).

  2. Parallels Desktop

    Default instructions are to reboot and then mount a CD from which you install the relevant tools. This went well and the directories were shared under /media/psf.

  3. VMWare Fusion

    VMWare requires you to install vmware tools on linux and you should get the mount automatically, but I didn’t, so I hade to add the line to /etc/fstab manually. Going with fstab is nice, as you can mount the share anywhere you like.

Performance

With that solved, I did a quick test of speed inside the VMs. Nothing comprehensive, just a quick feeler to see what kind of performance I can expect. To do that I ran the following python code, output mimicking that of the ping command:

import statistics
import timeit

l = []
for i in range(10):
	l.append(timeit.timeit("hashlib.pbkdf2_hmac('sha256', b'password', b'salt', 100000)", "import hashlib", number=100) / 100 * 1000)

print("min/avg/max/stddev = {:.3f}/{:.3f}/{:.3f}/{:.3f} us".format(
	min(l),
	statistics.mean(l),
	max(l),
	statistics.pstdev(l)
))

Times:

  1. UTM

    min/avg/max/stddev = 15.442/15.479/15.510/0.018 us (python 3.8.10)

  2. Parallels Desktop

    min/avg/max/stddev = 14.582/14.659/14.809/0.077 us (python 3.8.10)

  3. VMWare Fusion3

    min/avg/max/stddev = 14.596/14.632/14.713/0.031 us (python 3.8.10)

  4. Host

    min/avg/max/stddev = 23.598/24.297/25.038/0.553 us (python 3.8.9)

  5. MacBook Pro (Mid 2014)

    min/avg/max/stddev = 308.944/316.638/326.198/4.993 us (python 3.5.2)

    min/avg/max/stddev = 64.027/64.870/66.026/0.658 us (python 3.8.8)

I have no idea why the VMs are faster than the host – my guess is the VMs are running on performance cores, so python also gets a performance core, while python on the host runs on the efficiency core. Haven’t yet figured out how to confirm this though.

Update: I added times from my old laptop. Oddly python 3.5 was way slower, while there is no difference in times between 3.5 and 3.8 on arm (tested on Parallels).

Result

I think UTM could be great especially with its low price (free online, 9.99€ on the App Store), but everything is a bit finicky. If you can use one of the images provided and you don’t need to set up directory sharing, it’s surely a good option.

I don’t yet have a preference between Parallels and Fusion – Fusion has better folder sharing approach but kidnaps the cursor, which is quite annoying. At the moment Fusion is free (full price for Fusion 12 Player is 135.53€ while Pro is 180.98€ in the Europe store at the moment), while Parallels is already a paid product (99.99€ one time or 79.99€ per year, 99.99€ per year for Pro). As far as I have read, VMWare does not intend to support anything that is not Arm, while Parallels already has that support, which might make me go that way.

Next up

Next things I want to figure out:

  • does running an x86_64 VM makes any sense?
  • is it possible to mount a VM HDD without running the VM?
  • set up PyCharm to work with this setup

If you’re interested in anything else, let me know.

  1. Anybody know of a replacement for PresenterMate? ^
  2. For some reason I could not make the install work on a higher version (5.1, 6.x) ^
  3. I initially thought Fusion was much slower, but I likely screwed something up when measuring ^

Top 10 Usability Lows Of Mac OS

Wednesday, August 13th, 2008

White MacBook laptopImage via Wikipedia I’ve been using a Mac since I started my job at Zemanta. I wanted to have a Mac because I want to be able to use Windows and Mac OS and change from one to the other seamlessly. When I saw Top 10 Usability Highs Of Mac OS on Smashing Magazine and read the first point I figured that I don’t agree with the list. Strongly.

  1. Consistency

    There’s probably a lot of stuff that acts completely consistently but I think we can find this in all operating systems. What I really hate is that moving through text with the keyboard is really utterly inconsistent on a Mac. My Macbook keyboard is missing buttons that are very valuable to me when coding – Page down, Page up, Home, End. There are hints of these with Fn + arrow keys but in every application these act differently. And this all changes when using the wireless keyboard. The same goes for jumping over words / phrases…

  2. Intuitivity

    I didn’t get the install. Why would I have to drag something to Applications if I already decided to install it? It’s like a waiter coming back and rechecking your order. And it’s not really that intuitive – it took me a few installs (to get one where it was neatly explained with a “drag the app to the Applications to install”) to get it.

  3. Effective and appropriate metaphors

    I could agree with this but then again I have the desktop set to two screens and when on the top screen and an application is positioned so that it should appear on the bottom screen it doesn’t. Which isn’t really consistent. After a few tries I figured out that you can actually move stuff around if you persist long enough. Made me think though.

  4. Informative error reporting on-demand

    If this was true it would tell me that my wireless connection went down and I wouldn’t have to recheck it all the time. And it goes down often even though the other side is a Time Capsule which should be totally compiant.

  5. Hiding the technical details

    Great for novice users. But once in a while you want to get to know something more about your computer. And then you have to download 1GB of developer tools to get a simple compiler. I know, I’m not the target audience, I should really have a Linux instalation, right?

  6. Fitts’ Law

    I’m quite sure that I do a lot more mouse miles on a Mac than on a PC. There’s a simple reason — when you have two screens you have to decide where your menu bar will be. And if you’re using an application on the other screen you’re bound to have to make a trip every time you don’t know a keyboard shortcut. And you don’t if you’re a rookie user like me. I think this was a neat idea in the age of small single screens but times have changed – need to move on Apple

  7. User input feedback

    Having no OK and using auto-save and auto-apply where possible is great. If it really would be used this way consistently. Unfortunately some situations aren’t really the auto-save type and this makes you think – will the next click already apply or will it just change it and I can undo everything I made with a simple click on the Cancel button?

  8. User support and navigation

    This really is a great feature but it’s not a plus anymore. Vista has the same feature implemented and if we only look at it from a view of a user the only difference is that Vista’s is a bit slower. On the other hand it finds more stuff.

  9. Workflow

    This has more to do with the way you use an OS then the features of Mac OS. The only difference is that Mac OS actively discourages maximizing apps and has more features that help you find lost windows. The difference is getting smaller though.

  10. Even kernel panic looks nice!

    Haven’t ever seen a kernel panic yet. That doesn’t mean my Mac has never crashed, it only means I never saw a the panic screen. It crashed with a black screen, auto restart or just freezing.

I agree that there are many features that stand out on the Mac OS X but it also has a lot of stuff that is not as good as it could be. A nice example is the Finder that looks the same when opened as an application or when used as the browse window in another application. The only problem is that in the second case all the control-click options are gone and if you try to open a file and remember you have to update your repository first you have to go to another window and update it there.

Reblog this post