How To: Running Ubuntu and ROS in a Virtual Machine on macOS / OS X with 3D Acceleration (Gazebo)

I primarily use a Mac for my work, but since a I do a lot of robotics I have to switch over to Ubuntu to use ROS. Having a linux dual boot on a mac is doable and I have done it in the past (see instructions if you’re interested), but I just felt that giving up hard disk space for another operating system with a limited 512GB of storage is not something I wanted to do. Another issue is that the latest linux kernel doesn’t play well with the Macbook’s hardware, e.g., I could not get my machine to shutdown and it would get stuck which meant I would have to hard shutdown by keeping the power key pressed. That being said, I learned from a friend about the wonders of virtual machines, so here’s what I did.

Hardware: Macbook Pro Retina 15″ Mid 2015 (Model 11,5) running macOS Sierra. (I tried in El Capitan and it worked there as well).

Ubuntu Version: Lubuntu 14.04.5 (Lubuntu has all the goodness of ubuntu without the heavy add ons, good for virtual machines where you want to minimize resource consumption).

ROS Version: Jade

Instructions:

  1. Download and install VMWare Fusion (8.5 is what I’m using), I know of another virtualization option called Parallels but that is known to be more expensive than fusion in the long-term. Though if you’re a student you can get student pricing. There is a third option called Virtualbox which is free but its more difficult to setup and has known issues with 3D acceleration which may make using Gazebo problematic.
  2. Get Lubuntu 14.04 from here. I used Lubuntu because it is a lighter flavor of ubuntu with all the goodness and none of the more fancy stuff (bells and whistles). Its a pretty solid distro for ROS use and gets the job done. On a virtual machine you wanna consume less resources unless absolutely necessary so that you don’t slow down your host machine / os.
  3. Start up Fusion and choose the option “Install from disc or image”. Then follow the instructions and use the downloaded Lubuntu iso file.
  4. You will be able to choose the resources that you want to dedicate to your VM, here are my choices:
    1. Enable 3D acceleration in the Displays setting.
    2. I dedicated 4 cores from the 8 cores that I have available.
    3. 8 gb of RAM which is 50% of what I have available.
    4. 1024 MB of graphics memory.
    5. 40GB of hard disk space. Fusion will automatically choose swap size.
    6. I know this is all too generous, but what the heck, I want to run gazebo sims smoothly.
    7. Now let vmware do the rest.
  5. Now startup the virtual machine (vm) then in your bash rc file in Lubuntu, add the following line: export SVGA_VGPU10=0
  6. Follow ROS installation instructions and that’s it, you’re all set to go and run crazy ROS sims.

2 comments

  1. “1024 GB of graphics memory” seems extreme — that’s 1TB! Perhaps you meant 1024MB? My virtualbox slider only goes to 128MB, so I’m wondering if you saw gains by going beyond that.

    1. Hey Stan, yikes, that’s a typo, I have 2048 MB graphics memory, so I allocate 1024 MB. I used VMware fusion which allows me to go that high. I recommend using Fusion if you’re going to be running ROS+Gazebo. I do some graphics heavy sims and saw noticeable performance degradation if I used less than 1024 MB.

Leave a Reply

Your email address will not be published. Required fields are marked *