Running Azure Functions on M-series Macbooks in early 2023

Update: This post might fix the problem I had below.

Notes to self on how to get this going if you’re attempting to do a:

func start host

Notes from this post include doing the following:

  1. Enable Rosetta in iTerm by doing something a bit contorted: i/ duplicate iTerm, ii/ rename it as iTerm Rosetta, iii/ do a command-i to set it as a Rosetta terminal
  2. Verify that it’s running the i386 architecture by typing arch at the terminal
  3. Next you install the i386 version of homebrew … OMG
arch -x86_64 /bin/bash -c "$(curl -fsSL"

With your new i386 brew, install azure-functions-core-tools4** and a version of python with this homebrew. Point path to the new Rosetta Python. And just run it like:

arch -x86_64 /usr/local/bin/func start host

Yeah. I know. That sort of makes … sense.

Managing a World of Two Brews

Pro-tip for keeping the two brews clear in your own head and be generally more sane is here and method is noted as follows:

alias ibrew='arch -x86_64 /usr/local/bin/brew'
alias mbrew='arch -arm64e /opt/homebrew/bin/brew'

Set your path how you want it:

path=( /opt/homebrew/bin /opt/homebrew/opt /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Library/Apple/usr/bin )

This way you can choose your brew more carefully, like when told to install azure functions and Python into that intel-based brew, this will do the trick:

ibrew install azure-cli

This may require a little bit of sudo-ing along the way to get it to stick. Cross your fingers and do this according to this doc:

ibrew tap azure/functions
ibrew install azure-functions-core-tools@4

Check if the function command is available:

% ls /usr/local/bin/func

Aaaaand … does it work?

arch -x86_64 /usr/local/bin/func start host