Some hacking – Using Keka to import data from OS X to my VMs

Ever since I started using VirtualBox, I have needed a way to get data from my host operating system (Mac OS X) to the guests. This data includes drivers that I want to install in the guest, and programs and games that I want to run in the guest.

Sure there’s Guest Additions, but that has its own problems. For one thing, it only works with Mac, Windows, and Linux guests; there’s no drag-and-drop feature for things like DOS. Secondly, it requires the guest to have Internet access so you can install the guest addition drivers; if I have Internet access, then all I need to do is just email the files to myself in the host and download them in the guest. So basically, guest additions are merely a convenience that makes the already possible more practical; they do not enable you to do anything you couldn’t do before.

I realized my best bet for guests that either don’t have networking drivers installed or aren’t in the Mac/Windows/Linux category would be to find a way to turn the directories in my OS X filesystem into disk images, either floppy images or ISO files, so I could then insert them into the virtual drives of my VMs. I found a utility called Keka, which can be downloaded here. Keka is a file compression, extraction, and archiving utility for OS X. It can archive or compress files in several formats, and it can extract even more formats. Formats it creates include zip, gzip, bzip2, 7zip, tar, DMG, and ISO.

Keka

Though it is a graphical program, the interface for Keka isn’t particularly intuitive. It allows you to select a format to archive a directory to, but gives no indication of how to select a directory for archiving.  Through wild guesswork I discovered that you can do this by dragging the icon for the directory into the Keka window, after which it will automatically create an archive in the selected format.  Who knew?

The next step is of course to insert the newly created ISO into my virtual machines.  I can only do this with VMs that recognize optical disks, obviously, so MS-DOS 5.0 doesn’t work.  However, I was able to import Deluxe Paint into my FreeDOS VM.  I’m in the process of trying to import Norton Commander.

Storage

As an experiment, I tried converting some of the DOS folders to ISO files and using them to install software directly, as if they were floppies.  This didn’t work, because the installers require the disk to be mounted on drive A.  Obviously I wouldn’t be able to just change the extension, because it would still have the ISO-9660 filesystem, rather than the FAT filesystem, and it wouldn’t be recognized as a floppy.

Yeah, I kinda figured that wouldn’t work.

I’ve also tried using some software and games in VMs that I’m running on live ISOs, but there were some problems.  First, VirtualBox only allows for one optical drive.  You can work around this limitation by adding a USB drive and telling the VM to treat it as an optical drive, but when I did this, the VM tried to boot from the wrong ISO.  Maybe I should select the “Live CD/DVD” option.

Advertisements

Homebrew – “the missing package manager for OS X”

I made a pretty neat discovery recently. There’s this package manager for Mac OS X called Homebrew that allows you to install Unix packages from the command line, using the brew command. It’s patched together from Ruby scripts and shell scripts and uses git as a backend. You can install it on Mac OS X using the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This is much better than using apt-get in Mac OS X (now no longer an option), where it would barf because I didn’t have the XCode command line tools, but it would provide no indication of how to get said tools. That script installs the XCode tools automatically if they’re not there. It’s also better than manually compiling code from source, which can be a major pain the ass, especially when you run into dependency issues (which is more often than not the case).

Homebrew is very similar to apt-get in its command structure. For example, here is how you install a package:

brew install lynx

There are several other Homebrew commands worth remembering. For example:

brew edit lynx

This opens the source code for the installer script for the package in the default text editor.

Also:

  • remove – uninstalls a package
  • list – lists installed packages
  • search – lists currently available packages
  • update – updates a package

All of these have the same command structure: brew <command> <package>.

I’ve installed several packages so far. I will list them here:

  • Lynx – the text-mode browser
  • Snownews – an RSS feed aggregator for the CLI
  • Bitchx – a text-based IRC client
  • NASM – an x86 assembler
  • wget – allows you to download files from the command line
  • CLISP – Command Lisp compiler, interpreter, and REPL

This is an exciting discovery. Now I can use all my favorite Linux software in Mac OS X!