To setup my Raspberry Pi Z W I have combined two different guides since editing the files on the SD did not work, nor did I had the energy to setup Vagrant.

Start by flashing a micro SD card as described here using Etcher.

Insert the card into a Mac or PC and add enable_uart=1 to the end of config.txt as described here.

Insert the SD card in the Raspberry Pi and boot it as described here using a USB serial cable. Then in a terminal window run screen /dev/tty.usbserial-A7005Gpd 115200 (change to your device tty) to connect to the serial terminal on the Raspberry Pi.

Now you can follow this guide from step 3. Though I did not configure mine for two networks and here are how my configuration files look like:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf


country=SE
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
ssid="SSID_OF_NETWORK_1"
psk="password"
id_str="home"
}

sudo nano /etc/network/interfaces


source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback

iface eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

iface home inet dhcp