Tutorial: Running Linux On Mac OSX

I love my Raspberry Pi for tinkering with Linux. I can quickly try something on the more bare-bones OS than my Mac laptop, or use software that is otherwise not available to me. But sometimes SSH-ing into the low-power Pi doesn’t cut it and has left me frustrated. The options: buy a new computer just to run Linux (ok, but expensive for a once-in-a-while use) or install Linux on my Mac.

1. DOWNLOAD VIRTUALBOX
Oracle’s free VirtualBox software will let us install a variety of operating systems to play with. Download the current version for Mac here: https://www.virtualbox.org/wiki/Downloads

2. INSTALL VIRTUALBOX
We install VirtualBox like any other application. Once finished, make some new folders to store your OS’s and other files.

Create the folder Applications > VirtualBoxData

I would also suggest dropping the user manual PDF and  VirtualBox_Uninstall.tool  in there for later use. Learn more at https://www.sodapdf.com/pdf-editor/

Inside the new folder, create a folder called  OS  to store the operating systems, and a folder called VDI which stores our virtual files.

3. DOWNLOAD AN OPERATING SYSTEM
I’m running a Linux variation called Ubuntu – it’s popular, well maintained, and features a graphical interface similar to Mac OSX… which I immediately disable :)

Download Ubuntu (the desktop version) from here: http://www.ubuntu.com/download

Once it’s downloaded, it will unzip as a  .iso  file. Move it to the new  OS  folder you created in the previous step.

OPTIONAL SETTINGS
1. RESOLUTION SWITCHING
You may find that VirtualBox doesn’t let you change the size of the window. To change this, open up a Terminal window (control+alt+t) and type the following command:

sudo apt-get install virtualbox-guest-dkms

Restart VirtualBox and you should be able to change the size. Note this doesn’t seem to work for the command line, sorry.

2. BOOT TO COMMAND LINE
While the GUI of Linux is nice, I mostly just need the command line. Running an OS virtually already slows things down, so using a text-only interface works better for me. To boot to the command line instead, open a Terminal window and type:

sudo gedit /etc/default/grub

This will open a text editor where you can modify the following lines:

  • Comment-out  GRUB_CMDLINE_LINUX_DEFAULT=quiet splash  by adding a  #  to the start of the line
  • Change  GRUB_CMDLINE_LINUX=""  to  GRUB_CMDLINE_LINUX="text"
  • Un-comment  #GRUB_TERMINAL=console  by removing the  #  at the start of the line

Save the changes and exit Grub. In the Terminal, run this command:

sudo update-grub

Then restart VirtualBox – you should boot to the Terminal now! You can always go to the GUI by using the command startx.

3. MOUNT EXTERNAL DRIVES
Not intuitive, mounting an external drive to the virtual OS takes a few steps.

  • Plug in your drive. When it mounts to your Mac, eject it.
  • In VirtualBox, go to Devices > USB Devices and select the drive. It will automatically mount.
  • If running Terminal-only and your window freezes momentarily, hit Enter and it will come back.

Leave a Reply

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