0

What's the best way to run shell commands on a MacOS guest VM? Can't seem to run it through VirtualBox's guestcontrol, only lets you launch apps, not run commands directly. Saw some people suggest SSH, but wanted to see if there's a more direct way before I start down that path. Thanks!

  • Can you clarify your question a bit? Are you running macOS inside a VirtualBox or running a guest VM on macOS? – Wilfred Smith Mar 27 at 18:49
  • I'm running a MacOS High Sierra guest on a Windows 10 host. – Justin Taylor Mar 27 at 19:19
1

Finally got it working after about 8 hours of trying different things:

VBoxManage guestcontrol "vmname" run /bin/sh --username usr --password pass --verbose --wait-stdout --wait-stderr -- -c "echo test"

Hope this helps someone else!

0

If your guest OS is macOS, try having VBoxManage guestcontrol /bin/bash -c "commandToExecute"

SSH is a perfectly fine solution as long as you have a reliable way to get the IP address and your guest VM exposes SSH, has a key setup, etc.

  • Hmm... when I try to run /bin/bash (VBoxManage guestcontrol "MacOS High Sierra New" /bin/bash -c "echo test" --username usr --password ps) I keep getting this error: Syntax error: Unknown sub-command: '/bin/bash' If I try to include run in the command (VBoxManage guestcontrol "MacOS High Sierra New" run "/bin/bash" "echo test" --username usr --password ps), I get this error: No such file or directory – Justin Taylor Mar 27 at 19:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .