From 06ae9076dedcda45feebcd712c68ac4614411318 Mon Sep 17 00:00:00 2001 From: mzz <2017@duck.com> Date: Sun, 16 Apr 2023 17:16:49 +0800 Subject: [PATCH] Update run-on-macos.md --- docs/getting-started/run-on-macos.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/getting-started/run-on-macos.md b/docs/getting-started/run-on-macos.md index c8bd226..511e88a 100644 --- a/docs/getting-started/run-on-macos.md +++ b/docs/getting-started/run-on-macos.md @@ -181,8 +181,12 @@ Set default route of macOS to dae VM. > Refer to [run a script after a interface comes up](https://apple.stackexchange.com/questions/32354/how-do-you-run-a-script-after-a-network-interface-comes-up) if you want to auto execute it. ```shell -# Set gateway of macOS host to dae vm. -sudo route delete default; sudo route add default $(limactl shell dae ip --json addr | limactl shell dae jq -cr '.[] | select( .ifname == "lima0" ).addr_info | .[] | select( .family == "inet" ).local') +# Get IP of dae VM. +dae_ip=$(limactl shell dae ip --json addr | limactl shell dae jq -cr '.[] | select( .ifname == "lima0" ).addr_info | .[] | select( .family == "inet" ).local') +# Set gateway of macOS host to dae VM. +sudo route delete default; sudo route add default $dae_ip +# Set DNS of macOS host to dae VM. +networksetup -setdnsservers Wi-Fi $dae_ip ``` Verify that we were successful.