2 Replies Latest reply on Oct 16, 2015 5:52 PM by Eldan Goldenberg

    How to use TabGeoHack on a Mac with VirtualBox

    Eldan Goldenberg

      Richard Leeke's TabGeoHack is a fantastically useful addition to Tableau, but frustratingly for us Mac users it requires Windows.  I didn't want to have to use Tableau through a virtual machine, so I figured out how to use TabGeoHack in a virtual machine, but have it import geocoding to Tableau that is installed on the host Mac.  This means I only need the VM to change geocoding, not for day-to-day Tableau work.  Unsurprisingly, Tableau Desktop is noticeably faster on the host machine than in the VM.


      You will need:

      • VirtualBox, which is a free virtual machine host.  This can probably be achieved with other products, but my instructions assume VirtualBox.  If you get this working using a different virtualiser please post about it below - this will be useful to others.
      • A copy of Windows.  I am using Windows 7.  I would expect the same instructions to work in newer versions, but haven't tested them.  If you get this working with a different version of Windows, please also reply!



      1. Install VirtualBox
      2. Set up a VM running Windows.  From experience: VirtualBox lets you choose either a fixed hard drive size or a mode that lets the drive grow as needed.  You can't change this setting later, and if you choose a fixed size it needs to be > 20GB.  I gave mine 25, which is enough that I can also run Alteryx in it.
      3. Set up two shared folders, both with Access set to "Full" and Auto-mount enabled.  One should go to the Tableau repository on your Mac, the other to a folder where you'll put TabGeoHack and data files.  Here's how I have mine:
           path "/Users/eldan/Dropbox/TabGeoHack" name "TabGeoHack"
           path "/Users/eldan/Documents/My Tableau Repository" name "My_Tableau_Repository"
        What this does is to make these available as mapped network drives when you boot up Windows.  "path" is where the folder exists on the host Mac; "name" is how we'll refer to it from within the Windows VM. Note that VirtualBox assigns drive letters to these in alphabetical order, starting from E:, so in the setup I'm using My_Tableau_Repository is E: and TabGeoHack is F:
      4. Save TabGeoHack on your Mac, inside the first folder that you shared with the VM.  (i.e. my copy is in /Users/eldan/Dropbox/TabGeoHack )
      5. Install GDAL in the Windows virtual machine.  Mine is at C:\Users\eldan\Desktop\gdal
      6. Open tabgeohack.yml on the Mac, and edit it based on the following, with paths adapted to your system (and no indentation):

        # path of Tableau repository
        tableau_repository_path: \\vboxsrv\My_Tableau_Repository
        # GDAL installation path
        GDAL_installation_path: C:\Users\eldan\Desktop\gdal

      7. In the .yml file that defines the geocoding you'll be importing (start with the included geocoding_template.yml if you're starting from scratch), reference the shapefile and output directories in ways that will work from within the VM.  The important things here are that \\vboxsrv\ connects to all shared folders, the name after that is the name I mapped the shared folder as in step 3, and what's after that is subdirectories I created within /Users/eldan/Dropbox/TabGeoHack/

        # location of input spatial data files
        shape_file_dir: \\vboxsrv\TabGeoHack\shapefiles
        # location of various generated files
        output_dir: \\vboxsrv\TabGeoHack\TableauOutput

      Normal use (with new shapefiles):

      1. Prepare shapefile[s] (platform independent)
      2. Drop them into whatever directory you've indicated as shape_file_dir
      3. Edit the geocoding...yml file to tell TabGeoHack about the new shapefile[s]
      4. In the Windows VM: open a command line and go to the drive letter for the TabGeoHack mapped network drive (F: in my setup)
      5. In the Windows VM: run tabgeohack --roles etc
      6. Back in Mac OS: open Tableau and import custom geocoding as normal.  NB: in my setup I usually get warnings about UNI_ID_Features.csv not containing Latitude & Longitude columns, and UNI_ID_points.csv not containing a unique column - these are safe to ignore.
      7. Close Tableau
      8. In the Windows VM: run tabgeohack --shapes etc
      9. Back in Mac OS: Hooray!  Your geocoding is now loaded.


      Normal use (with previously loaded shapefiles):

      I have not managed to get --assign to work in this setup.  However, I have had good results with making separate .yml files and subdirectories for different countries' geocoding, and using --activate to switch between them.  I just have to close Tableau on the Mac, call tabgeohack --activate countryiwant.yml from the Windows VM, and then reopen Tableau on the Mac.