Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

psid

macrumors member
Original poster
Jun 10, 2010
35
0
VMware Fusion relies on various kernel extensions and daemons that are started when Mac OS X boots. These components are always active even when the VMware Fusion application is not running.

This is a guide to tweak VMware Fusion so that it manually starts the required components according to a user configuration file and to stop everything when the application quits.

This guide uses two custom scripts I created:

vmware.sh: This script replaces the actual vmware binary and is what gets run first when you start the VMware Fusion application. It creates a default configuration file at ~/Library/Preferences/com.vmware.fusion.netopt.plist. It calls bootnetopt.sh --start and then runs the actual vmware binary. After that it waits until the application quits at which point it calls bootnetopt.sh --stop.

bootnetopt.sh: This scripts reads the com.vmware.fusion.netopt.plist configuration file and starts only the required kernel extensions and daemons. This obviously need to be run as root (using sudo) but we don't want it to ask for a password every time. We have to add it as an exception to the sudoers file (see step 5 below).

How to apply it all:

1. Download vmwarenetopt.zip and extract it to your desktop.

2. Stop all currently running vmware components.

$ sudo /Library/Application\ Support/VMware\ Fusion/boot.sh --stop

3. Remove vmware's launchd file so that nothing gets started automatically at boot.

$ sudo rm -f /Library/LaunchDaemons/com.vmware.launchd.vmware.plist

4. Copy scripts inside VMware Fusion.app

$ sudo mv /Applications/VMware\ Fusion.app/Contents/MacOS/vmware /Applications/VMware\ Fusion.app/Contents/MacOS/vmware.bin
$ sudo cp ~/Desktop/vmwarenetopt/vmware.sh /Applications/VMware\ Fusion.app/Contents/MacOS/vmware
$ sudo cp ~/Desktop/vmwarenetopt/bootnetopt.sh /Applications/VMware\ Fusion.app/Contents/MacOS/

5. Add bootnetopt.sh to sudoers.

This is done using the visudo command which must be run with sudo (we cannot give ourselves permission to be running a script as root without first being root) and lets use a more sane editor than vi (no offence to any vi wizards) so type:

$ EDITOR=/usr/bin/nano sudo visudo

Go to the end of the file and add the following line exactly:

ALL ALL = NOPASSWD: /Applications/VMware\ Fusion.app/Contents/MacOS/bootnetopt.sh

Press ctrl-x to quit the editor, press y to reply yes to save the changes and finally press return to confirm the file name.

6. That's it. Well done.

From now on we can run the VMware Fusion application normally and can see that all required components are started:

$ kextstat | grep vm
192 0 0x6d144000 0xd2000 0xd1000 com.vmware.kext.vmx86 (3.0.0) <11 5 4 3 1>
193 0 0x57531000 0xc000 0xb000 com.vmware.kext.vmci (3.0.0) <5 4 3 1>
194 0 0x57181000 0x6000 0x5000 com.vmware.kext.vmioplug (3.0.0) <34 29 5 4 3 1>
195 0 0x57f05000 0xa000 0x9000 com.vmware.kext.vmnet (3.0.0) <5 4 3 1>

$ ps -Ac | grep vmnet
22244 ?? 0:00.02 vmnet-bridge
22254 ?? 0:00.00 vmnet-dhcpd
22256 ?? 0:00.00 vmnet-netifup
22258 ?? 0:00.00 vmnet-dhcpd
22261 ?? 0:00.01 vmnet-natd
22263 ?? 0:00.00 vmnet-netifup

$ ifconfig -l
lo0 gif0 stf0 en0 fw0 en1 vmnet1 vmnet8

And if we quit the application we can see that everything else is stopped as well:

$ kextstat | grep vm

$ ps -Ac | grep vmnet

$ ifconfig -l
lo0 gif0 stf0 en0 fw0 en1

But we can go further than that and edit the com.vmware.fusion.netopt.plist configuration file (using Property List Editor or the defaults command). If for example we only ever use bridge networking for our VMs we can disable Host Only (vmnet1) and NAT (vmnet8).



And confirm that only the vmnet-bridge daemon gets started and that vmnet1 and vmnet8 are not created:

$ kextstat | grep vm
196 0 0x6d144000 0xd2000 0xd1000 com.vmware.kext.vmx86 (3.0.0) <11 5 4 3 1>
197 0 0x57531000 0xc000 0xb000 com.vmware.kext.vmci (3.0.0) <5 4 3 1>
198 0 0x574d9000 0x6000 0x5000 com.vmware.kext.vmioplug (3.0.0) <34 29 5 4 3 1>
199 0 0x57f05000 0xa000 0x9000 com.vmware.kext.vmnet (3.0.0) <5 4 3 1>

$ ps -Ac | grep vmnet
22347 ?? 0:00.01 vmnet-bridge

$ ifconfig -l
lo0 gif0 stf0 en0 fw0 en1

Also notice how we could easily customise the IP address ranges used for Host Only and NAT networking from the same configuration file, no root permissions or editing of scripts required anymore.

Finally a disclaimer: I created this for my personal use and posted it here so that it might be useful to others. If you decide to follow the guide please make sure you understand what you are doing before proceeding or ask first. I have tested this with both VMware Fusion 3.0 and 3.1 and had no problems but please understand that I can not guarantee anything.

Update: Confirmed working with Lion and VMware Fusion 3.1.3, but see here https://forums.macrumors.com/posts/13171285/ for more info and an update on how to do step 5.
 
Last edited:
Just stumbled across your thread - interesting. I don't have any intention of trying it at this stage, but I'm interested to know, what are the benefits of what you have detailed?
 
Just stumbled across your thread - interesting. I don't have any intention of trying it at this stage, but I'm interested to know, what are the benefits of what you have detailed?

Like I explained VMware Fusion starts 4 kernel extensions and 6 root daemons when Mac OS X boots. These all stay active forever even when the VMware Fusion application is not running.

While these components don't cause any trouble at the very least they slow down startup and shutdown of the OS. But basically I just don't like them running when I don't need them.

I don't use VMware Fusion every day but since I still need it from time to time I wanted a way for all these components to only get started when I myself run the VMware Fusion application and then have them to stop when I quit the application. And that's exactly what this guide does.
 
Ok thanks for that explanation. Sounds like you've put a fair bit of work into it. I will keep this in mind if I ever feel adventurous with nothing else to do ;)
 

I hadn't seen that before but it seems to be doing something similar.

Except that what I described here is a bit more automated after you've gone through all the steps.

Then you just run and quit the actual VMware Fusion application and the required components start and stop as well. No need for another utility to do this for you.
 
Nice work! I also hate things running when it's not necessary and this works brilliantly. It also cut my startup time by at least half!! Thanks a lot.
 
Brilliant PSID!

I've also copied and pasted your instructions to my Tips & Tricks reference. Luvin' it. Thanks much.
 
I followed these steps and now when I try to load up my VM I get

"Could not open /dev/vmmon No such file or directory"
"Failed to initialize monitor device"
"Cannot find a valid peer process to connect to"

So I deleted that VM and tried to create a new one but it's been preparing my partition for almost an hour now.
 
What if i delete my VM and want to reverse your workarounds, how would that go?
 
To eleven7, VideoFreek, ssn637:

Thanks guys for the good words. Glad you find this useful.
 
I followed these steps and now when I try to load up my VM I get

"Could not open /dev/vmmon No such file or directory"
"Failed to initialize monitor device"
"Cannot find a valid peer process to connect to"

So I deleted that VM and tried to create a new one but it's been preparing my partition for almost an hour now.

These messages mean that the VMware kernel extensions are not loaded.

You've probably done steps 2 and 3 successfully so that no components are running anymore but have not successfully done the rests of the steps. Please note that each line starting with a $ is a different command to be type entirely as it is (but without the $) and that capitalisation and spacing matter so better copy and paste them one at a time.

Also step 5 is a bit tricky and the line should be added exactly as shown at the end of the file.

If you still have trouble please show any commands that give you any errors so that I can help you further.
 
What if i delete my VM and want to reverse your workarounds, how would that go?

If you have a basic understanding of the command line it should be easy to reverse the steps and put back the original files. Otherwise a simple reinstall of VMware Fusion will not cause any harm and will also replace the changes getting back the original behaviour.
 
This is great, I'm going to do it when I get home.

When I did a clean install of Snow Leopard I was so happy that it only took 12 seconds to boot. Then I installed Fusion and it started taking over a minute and a long time to shut down. Looking forward to some decent times again!
 
wow, this is great - thanks a lot!

now, if i ever update vmware fusion, should i re-do all of the above steps?
 
wow, this is great - thanks a lot!

now, if i ever update vmware fusion, should i re-do all of the above steps?

Glad you like it. And yes if you reinstall or update you'll need to redo the steps (all except step 5, that change remains).
 
Interesting. I will try this tonight, thank you. Delicious'd! :)

As an addendum to this, something I discovered today, and it's basically the same thing as you have above, but a solution to a different problem (wish I'd seen this before spending a half hour investigating VMware NAT processes! :) ):

The last 2 days I've been running 2 or 3 VMs at the same time, and needing to use NAT, as I've only been given 1 IP for running tests on a particular VLAN/Subnet. To access and run tests on another VLAN I've needed to change the host IP manually and the switch port - but noticed the the VMWare nat processes really struggle to update when the host IP is changed, so the VMs lose network connectivity. This is no use when the tests are exclusively network based!

The initial solution was to reboot the mac - this involves shutting down the VMs etc. It's apparent that doing this multiple times a day is will make it impossible to get anything done, so the solution I found was to run:

Code:
$ sudo /Library/Application Support/VMware Fusion/boot.sh –restart

which basically re-initialises the vm services and by proxy the nat services - now the VMs pick up the new nat settings and testing can continue. It's maybe a little heavy handed, but I needed something quick and dirty so that I could get on.

The best news is that you can run this script while the VMs are open and running, so it's really convenient.

Really impressed that Fusion was stable enough to do this. This software rocks. :)
 
Last edited:
Another Fusion tip - a long winded solution to a host OS crash while using a VM, where the VM will then not start.

The other day was doing some testing, left the machine to it and came back around 15 mins later. The Fusion process had stalled... In the app. monitor it was listed as 'not responding' and had hung OSX. The only way to regain control was hard power off. When it came back up, the VM wouldn't start. Calamity! A day's testing, gone!

The error was, "Can't lock file" or similar. The solution was to examine the Fusion logs to find out which file in particular was still around, then delete it. It will be a '*.lck' file. VM then worked perfectly.
 
Tried, possibly wrong version?

Hi PSID,

I tried this hoping it would work for me, but similar to the post above, my VMWare wouldn't load. I tried it three times, all with same results. I had to re-download VMWare and reinstall it (I love that my WindowsXP image is set, regardless of reinstalling).

Are the instructions above for a specific version of VMWare? I am on OSX 10.6.7 (latest) and VMWare is 3.1.2 (latest). I wouldn't expect you to have tried this on every version, and definitely appreciative of your work!
 
Hi PSID,

I tried this hoping it would work for me, but similar to the post above, my VMWare wouldn't load. I tried it three times, all with same results. I had to re-download VMWare and reinstall it (I love that my WindowsXP image is set, regardless of reinstalling).

Are the instructions above for a specific version of VMWare? I am on OSX 10.6.7 (latest) and VMWare is 3.1.2 (latest). I wouldn't expect you to have tried this on every version, and definitely appreciative of your work!

Hi, I don't really think it is version related. If you can describe exactly what the problem is maybe I can help a bit more.

As I already mentioned it in a post above spaces and capitalisation do matter. Do any of the steps give you any specific errors?
 
I just tried this out and it definitely worked for me (VMware 3.1.2, OSX 10.6.7). Just wanted to give a big thanks to psid for writing this tutorial, I wouldn't have ever figured this out, and I absolutely hate processes running when they don't need to be. I thought I was imagining things when my macbook felt slower to boot after I installed VMware. Don't know why the app wasn't written to be like this in the first place.

Cheers mate :)
 
syntax error

Uh-oh, I shouldn't have tried this, terminal is uncharted territory for me. [Oops: "please make sure you understand what you are doing before proceeding or ask first"] I can't remember what happened the first time (something not right, anyway) but levymetal's post [I just tried this out and it definitely worked for me (VMware 3.1.2, OSX 10.6.7)] gave me the courage to try again as I too am running OS X 10.6.7 with VMware Fusion 3.1.2
As you can see I tried applying the ALL ALL line again after the first syntax error, but I wasn't sure where the end of the file was after opening the EDITOR... Some help would be much appreciated. Now to reinstall VMware Fusion.
...
Stopped all configured services on all networks
No matching processes were found
No matching processes were found
No matching processes were found
No matching processes were found
No matching processes were found
No matching processes were found
(kernel) Kext com.vmware.kext.vmcrosstalk not found for unload request.
Failed to unload com.vmware.kext.vmcrosstalk - (libkern/kext) not found.
(kernel) Kext com.vmware.kext.vmmon not found for unload request.
Failed to unload com.vmware.kext.vmmon - (libkern/kext) not found.

MvS-MacBook-OSX:~ Marika$ sudo rm -f /Library/LaunchDaemons/com.vmware.launchd.vmware.plist
MvS-MacBook-OSX:~ Marika$ sudo mv /Applications/VMware\ Fusion.app/Contents/MacOS/vmware /Applications/VMware\ Fusion.app/Contents/MacOS/vmware.bin
MvS-MacBook-OSX:~ Marika$ sudo cp ~/Desktop/vmwarenetopt/vmware.sh /Applications/VMware\ Fusion.app/Contents/MacOS/vmware
MvS-MacBook-OSX:~ Marika$ sudo cp ~/Desktop/vmwarenetopt/bootnetopt.sh /Applications/VMware\ Fusion.app/Contents/MacOS/
MvS-MacBook-OSX:~ Marika$ EDITOR=/usr/bin/nano sudo visudo
>>> /etc/sudoers: syntax error near line 45 <<<
What now?
Options are:
(e)dit sudoers file again
e(x)it without saving changes to sudoers file
(Q)uit and save changes to sudoers file (DANGER!)

What now? e
>>> /etc/sudoers: syntax error near line 46 <<<
What now?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.