Top

Thursday 1 March 2012

How to Run Mac Apps on Linux

Linux is beloved by many around the world for its simplicity and ultimate customization Because it's open source (and free!) many Mac users choose to run it as a virtual machine on VMWare, Parallels, or even Virtual Box. However, sometimes you might want to run a Linux-based application without having to jump through too many hoops. Using a SSH tool called X over SSH2, you can graphically load remote Linux apps and use them right on your Mac.

What You’ll Need:

>> Linux computer or virtual machine on a Mac
>> Apple X11

Difficulty: Medium
Note: You may use any distro of Linux you like, but the instructions may be slightly different depending on which distro you choose. We’ll be using Ubuntu installed in a virtual machine.

1. Install X11


The first step is to install X11, Apple’s implementation of the X Window System. Before downloading and installing X11 from the link above, check to make sure you don’t have it already installed. If it is already installed, you will see an icon for X11 in your /Applications/Utilities directory on your Mac. The install process is relatively simple if you have installed Mac OS X software before.

2. Install SSH in Ubuntu

Before we begin connecting to our Ubuntu machine, we must first install SSH. SSH (or Secure Shell) is a way that you can securely connect to your machine remotely in a command-line fashion using Terminal on your Mac. By default, this functionality isn’t installed.



To install SSH in Ubuntu, open Terminal (located in Applications > Accessories). Once Terminal is opened, type the commands below, one after another, followed by the enter key. You will be prompted for your password after the first command is entered.

sudo apt-get update
sudo apt-get install ssh




After the install completes successfully, and while we’re still in Terminal, type in the following command to get the IP address of your Linux machine:

ifconfig

After typing this command, a few lines of text will be outputted to the screen. Copy down the IP address under the eth0 “inet addr” field. This will be the IP address of that machine on your local network. This address will be used to connect over SSH in the next step.

3. Connect Via SSH on Your Mac


After the previous two steps have been completed, we can now finally connect to your Linux machine through SSH. To do this, open Terminal on your Mac (located in /Applications/Utilities) and type in the following command:

ssh Username@IPAddress -X

Replace “Username” with your username on your Linux machine, and replace “IPAddress” with the address that you copied down in the previous step. For example, my connection command looks like this:

ssh cory@172.16.94.129 -X

After you type this command and press the enter key, the connection will open and you’ll notice that X11 will also start. This happens because we included the “-X” argument in the command, which tells SSH we’re going to use the X Window System remotely.

4. Launch Graphical Programs Remotely

To launch a program, simply type the name of the program into Terminal on your Mac. When you do this, the graphical Linux program will be loaded through X11 on your Mac. You will be able to see and control the application just as if it were native.



As an example, we’ll launch Firefox by typing “firefox” into the Terminal that’s connected via SSH to our Linux machine.



After a few seconds of loading, X11 will present you with the Linux version of Firefox, which can be control locally on your Mac just like a native application.

Pretty nifty, huh? You can even load games, image editing applications, and more.

6 comments:

Anonymous said...

Fix your title, that is not running Mac apps on Linux at all. That's running Linux apps on a Mac

Anonymous said...

I agree, the topic title is misleading and very inappropriate for the given subject. please do change it!

Anonymous said...

yet another apple moron

Anonymous said...

O.o -- daFuq?

Nadeem Khan said...

lol.. moron

Anonymous said...

actually what he did was simplify a complex concept into common terms for common computer users. He turned his Mac box into a X Windows Server and made the linux box a thin client ssh: cory@172.16.94.129 -X

quit bashing, there's nothing moronic about this post. Thanks bilel for reaching out to beginners that could really use this information.

Post a Comment

Twitter Delicious Facebook Digg Stumbleupon Favorites More