Friday, 26 December 2008

Running Microsoft Windows in a window in Mac OS X... in order to use a Windows-only printer

Soon after setting the Mac Mini up, I found out that my friend also had a Windows-only application he needed to use for his work, as well as a laser printer that only worked in Windows (it was a Canon with a proprietary printing system, no PostScript/PCL or anything like that, and drivers for Windows only). Argh.

You could simply buy a new printer (you're in the Apple world now, money is no object). But why replace a perfectly good printer? The printer was also a multi-function device - and good ones, incorporating laser printers, aren't so cheap.

Apple does publicise the fact that you can install Windows alongside Mac OS X using Boot Camp, but this involves re-booting your PC to run Windows. This will get tiresome if all you need Windows for is a single application and a printer.

Thankfully, there is a solution - which is geeky but straightforward - that lets you run both Mac OS X and Windows at the same time and, with a bit more work, enables you to hit 'print' in any Mac application and print seamlessly.

You can achieve this in 3 big, but not too big, steps:

1) Use VirtualBox to create a virtual PC, and install Windows in it

VirtualBox is a top-notch virtualisation product which is free to download. You can read the background on virtual machines and virtualisation on Wikipedia, so I'll jump straight to what you can use VirtualBox to do. With VirtualBox installed, you can run Windows in a window in Mac OS X! The only condition is that your Mac needs to be a reasonably recent one with an Intel processor. You can download it at the VirtualBox website.

VirtualBox comes with a very good user manual, so I won't go into too much detail here, but I'll outline the steps:
  • You'll obviously a Windows CD, and if you're a PC user you should be able to free up a Windows licence to use.
  • Fire up VirtualBox, and create a virtual box for the version of Windows you're going to install.
  • RAM - Based on my experience with Windows XP, 256MB is enough, and if it's solely for printing, then you can probably use less (e.g. 192MB) without issues.
  • CD drive - Make sure you initially give the virtual box control over the CD drive, so you can run the Windows install CD from it. After the installation's done, you can easily change the virtual box set-up so the CD drive isn't handed to the virtual box by default.
  • Network - Set your networking option to 'host interface', so that the virtual box appears just like another computer on your home network. Also set the network adapter to the Intel Server one, as this is immediately recognised by Windows without the need to install drivers.
  • USB - Set up a USB device filter, so that the virtual box is given control of the attached printer. If your printer doesn't have a USB port, parallel-to-USB adapters are available cheaply from eBay.
  • Finish the set-up, and start the Windows virtual box with the Windows CD in the drive. VirtualBox will 'mount' your CD drive, so the CD icon will disappear from your Windows desktop. VirtualBox will display messages about what your 'keyboard/mouse capture' keys are - make a note of this, as initially you'll need to hit a key to 'release' your keyboard/mouse from the virtual box.
  • Wait for the virtual PC to boot from the Windows disc. Follow the instructions to install Windows just like you were installing Windows on a normal PC. While Windows is installing, you can just minimise the VirtualBox window and do whatever you want on the Mac itself while it installs. Cool eh?
  • Once the Windows installation is complete, use the VirtualBox Devices menu (in the Mac's menu bar, not in the virtual PC window) to unmount the Windows installation CD, so it appears on your Mac desktop again. You can now eject the CD in the normal way.
  • From the same VirtualBox menu, click the option to install the 'guest additions'. Now you don't need to worry about 'releasing' your keyboard/mouse anymore. You can go to Display Properties to change your screen resolution (and therefore the size of the VirtualBox window).

2) Set up the printer in Windows

Having followed the above steps - specifically the USB filter one - the virtual PC would now be connected to your printer. Without drivers installed, it will most likely appear as an unknown device within the Device Manager (under Control Panel > System).

Head to the manufacturer's website, download the Windows drivers in the usual way and install them, and print a test page from within Windows.

3) Set up PostScript emulation in Windows, and share the PostScript driver with your Mac

If all's well, you can start setting up the bridge to Mac OS X, beautifully documented by Robert Harder - click through for his step-by-step instructions.

Please note that step 5 is slightly different in the latest version of Mac OS X - you should go to 'System Preferences' in your Mac, then 'Print & Fax', and then add the IP printer from there. If you're willing to experiment, you may be able to skip a few steps by looking at the advice given in the users' e-mails posted on that page.

Once you've followed those instructions, it's done! You can now hit print in any Mac application and it will print seamlessly.

A few notes...
  • If you minimise VirtualBox, the only hint of the complex solution will be it's icon in the tray at the bottom. The downside is that VirtualBox needs to be always running in order for you to print (though that's no big deal if it's minimised), and more importantly whatever RAM you've allocated to Windows will be lost to Mac OS X while VirtualBox is on. That said, this is unlikely to cause you a problem - on a Mac with 1GB RAM, I gave 256MB to the Windows virtual box without noticing a performance hit to applications running on the Mac.
  • There's no need to go to all this trouble if your printer has Mac drivers, or if that Windows application you need has a Mac alternative. Use Google and manufacturers' websites to exhaust all Mac options first.
  • Obviously the Windows virtual box will be susceptible to viruses/malware etc. just like an average Windows PC, but as long as you use it only as a printing pass-through, you don't need to worry about this. But how do you prevent kids from opening up the virtual box and messing about with Windows? You may want to consider installing SteadyState (free from Microsoft) to lock down Windows and prevent anything you don't want from being installed.
  • When connecting your Mac to the printer on Windows, if you specified an IP address rather than the computer's name, you will probably want to ensure this IP address is static. Most routers will have an option to assign static LAN IP addresses to computers on the network, identified by their MAC addresses. Fortunately, your virtual box will have it's own unique MAC address (viewable from the VirtualBox set-up), enabling you to do this.

No comments:

Post a Comment