When I’m developing desktop applications in LiveCode I need to test on both macOS and Windows. My primary development platform is macOS and I run Windows using VMWare Fusion. Since I use the Levure framework I can switch over to VMWare at any time, launch a pre-compiled executable, and quickly see how my app behaves. The precompiled executable loads the current development files so I’m testing what I’ve been working on in the LiveCode IDE on macOS.
Up until yesterday there was a problem, however. If I find a bug while testing in Windows I like to switch back to macOS, make the necessary code changes, and then launch the pre-compiled executable to test again in Windows. But sometimes when I launched the executable I would get an error because the source file I just edited (e.g. a .livecodescript file) would be corrupted. For some reason, Windows running under VMWare Fusion was only seeing a truncated version of the file I had just edited. If I opened the file in NotePad I would see that some of the file contents at the end of the file would be missing. The only way to fix the issue was to restart Windows which really slows things down when you are trying to troubleshoot a bug. (Watch a screencast demonstrating my workflow.)
The interesting thing is that this had not always been a problem. In the past I had used the same workflow with VMWare Fusion and had no problems.
Yesterday I upgraded to VMWare Fusion 10 hoping that the problem might be fixed. When I saw that it wasn’t I decided to email VMWare support to see if they knew what was going on. I was pleasantly surprised to get a call back from their technical support team in no time at all. We got on a screen sharing session, I showed them what was going on, a knowledgable person then got on the phone with me and talked me through the solution which I will describe below.
Don’t use Shared Folders for development work
At some point I had set up VMWare Fusion to use Shared Folders. This is an easy way of making folders on macOS available to Windows. While it is convenient, the feature wasn’t designed to be used the way I’m using it for development work and the issue I described above can occur.
Mount a network drive
The solution is to mount your macOS folder as a network drive. This involves a little more work but is simple enough if you know what to do. I’m going to show you how to create a private network between VMWare and your Mac so that you don’t have to worry about which network you are on.
- To begin, turn off your VM and open the settings.
- Click on the Add Device… button.
Add a Network Adaptor
Select Private to my Mac
- Click on the Private to my Mac option
- Click Show All
You should now see two network adaptors in the Settings window.
Turn on File Sharing on your Mac
- Navigate to the System Preferences > Sharing panel and turn on File Sharing.
- Make note of the smb address.
- Click on the Options… button.
Turn on SMB file sharing for your account
In order to mount your folder as a network drive in VMWare you will need to check the box next to the account you want to share.
Map network drive
You are now ready to launch Windows in VMWare Fusion and map a network drive.
- Select This PC in the left column of a Windows Explorer window.
- Click on Map network drive and select Map network drive.
Enter the path to your macOS user folder
Using the smb address you noted earlier, enter the path to your user folder on macOS. In this example I used the following:
Enter your macOS login and password
Your macOS folder will now appear as a networked drive under Windows. You can drag any folders from the networked drive to the Quick Access area so that you can quickly navigate to the applications you want to test. Using this approach you can edit files in macOS and know that the file contents will be updated properly within Windows running in VMWare Fusion. Happy testing!