Why does this not work in 5.x

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
brycesteiner
Posts: 97
Joined: 7. Nov 2008, 16:04
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, Windows

Why does this not work in 5.x

Post by brycesteiner »

I've upgraded to 5.0 then .2 and .4

Something I cannot get working for anything is the command to start the command from applescript. Here is what I always used in 4.x

Code: Select all

do shell script "vboxmanage startvm 'XPworklaptop'"
and it worked great when saved as an app. Now I get:

error "sh: vboxmanage: command not found" number 127

It doesn't matter which Mac OS I use. I've tried 10.8 10.10 and 10.11 and they all have the same effect: It works with 4 but not 5.

From what I read in the manual the command hasn't changed.

What am I doing wrong?
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Why does this not work in 5.x

Post by socratis »

Well, I tried with 5.0.4, 4.3.32, 4.3.0, 4.2.26 and 4.1.28 and I got the same error (4.0.20 got me a kernel panic; haven't had one for years). I got the same error as you did, so I don't know how you managed to get it working in the 4.x series. BUT, if I change the script lightly to:
   do shell script "/Applications/VirtualBox.app/Contents/MacOS/VBoxManage startvm FreeDOS"
or
   do shell script "/usr/local/bin/VBoxManage startvm FreeDOS"
it works as expected.

That means that from the Applescript it needs the full path to the VBoxManage command. Now, on the other hand, if I do it from the terminal:
   osascript -e 'do shell script "VBoxManage startvm FreeDOS"'
it works. Kind of counter-intuitive if you ask me.

N.B.: I don't remember exactly when (I think after 10.9), but the VBoxManage used to reside in /usr/bin, not in /usr/local/bin, so adjust accordingly.

P.S.: Tested on Mac OS X 10.9.5, but I don't think it makes a difference...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
loukingjr
Volunteer
Posts: 8851
Joined: 30. Apr 2009, 09:45
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: just about all that run

Re: Why does this not work in 5.x

Post by loukingjr »

FWIW, In OSX 10.10 & 10.11, VBoxManage is in /usr/local/bin. I believe everything was moved with VB 5.0 to be SIP compliant.
OSX, Linux and Windows Hosts & Guests
There are three groups of people. Those that can count and those that can't.
brycesteiner
Posts: 97
Joined: 7. Nov 2008, 16:04
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Linux, Windows

Re: Why does this not work in 5.x

Post by brycesteiner »

@socratis

Thanks for the info. That worked perfectly. I didn't think to write in the whole path.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Why does this not work in 5.x

Post by socratis »

I tried to find more information about this behavior of AppleScript, but I couldn't. Apparently when run from the AppleScript editor or a standalone app, the whole path variable is not passed through to the app's environment.

But, this is an OS X issue, so I don't want to expand on this issue on these forums...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply