X11 Applications For Mac

  1. X11 App For Mac
  2. Install X11 Mac
  3. Mac X11 App
  4. X11 Utility Mac
  5. X11 Application For Mac
  6. Mac X11 Client
  7. X11 Applications Mac Os X

X11.app was initially available as a downloadable public beta for Mac OS X 10.2 Jaguar and later included as a standard package for Mac OS X 10.3 Panther.In Mac OS X 10.4 Tiger X11.app was an optional install included on the install DVD. Mac OS X 10.5 Leopard, Mac OS X 10.6 Snow Leopard, and Mac OS X 10.7 Lion installed X11.app by default, but from OS X 10.8 Mountain Lion on Apple. X11 for Mac OS X offers UNIX users the ability to run thousands of X11 applications concurrently with other Mac OS X applications. This one goes to 11. X11 for Mac OS X offers a complete X Window. The Xquartz project is an open-source effort to develop a version of the X.org X Window System that runs on Mac OS X. Together with supporting libraries and applications, it forms the X11.app that.

Running xeyes is a useful proof of concept useful for containerizing applications which need UIs.

X11 App For Mac

Author:
Christian Hujer, Software Crafter and CEO / CTO of Nelkinda Software Craft Private Limited
First Published:
by Nelkinda Software Craft Private Limited
Last Modified:
by Christian Hujer
Approximate reading time:

Running xeyes in Docker seems a bit like an unnecessary stunt. True, running xeyes in Docker has no practical purpose in itself. But the whole point is actually not about xeyes. It is about how to get an X11 application running in Docker in general.

1 Purpose

I came across this problem when I actually wanted to do something else. For a client project, I need to setup a IBM Lotus Domino server and fill it with sample data. It seems that without a GUI, performing this setup ranges from hassle to impossible. Whether something is good server software if it can't be configured from a terminal window is a different story. Hello, IBM, are you listening? I already messed up my system once when trying to get IBM Lotus Notes installed to administer IBM Lotus Domino. I didn't want this to happen again. So I thought of containerizing the two IBM Lotus applications. But when doing so, there is a challenge: How do I get the UI of the IBM Lotus applications from within Docker display on my Docker host? I could've used VNC. But mind you, I'm running Linux inside Linux, so why not use X11 directly?

So, the purpose of running xeyes in Docker is a proof of concept. There are many things why running applications inside Docker could go wrong. X11 is one of the things that can go wrong. With running xeyes in Docker, there is a proof of concept that running X11 applications inside docker works. It helps isolating and fixing one problem at a time.

2 Ingredients

The ingredients are:

  • The Linux kernel, providing containerization support.
  • The X11 system, with an X11 server running on the Linux host.
  • Docker, to run software in containers using docker run.
  • xeyes to be run inside a container.

2.1 X11 Considerations

You should only run applications this way which you trust. The applications in the container will be able to use X11 to intercept mouse and keyboard. For example, they could perform key-logging. So, only do this with trust-worthy applications.

Security Alert! Only run trustworthy applications this way!

If your reason for containerization is not security, it's just fine. But if the reason for containerization was security, you should probably prefer VNC over X11.

3 The Dockerfile

The Dockerfile has to do the following things:

  • Use a Linux distribution that has xeyes available as a base.
  • Install xeyes
  • Create and use a user named user, we don't want to run X11 applications as root.
  • Specify xeyes as entry point.

3.1 Explanation

  • The FROM debian:latest selects the latest version of Debian. I do not use this image in production, otherwise I would pin down the version.
  • The RUN apt-get line updates the package index. Then it installs x11-apps, which is the package that contains xeyes.
  • The RUN rm -rf line removes a bunch of files that are not needed for this proof of concept. This is not necessary. It's an easy way to reduce the image and container size a bit.
  • The RUN useradd line creates a user named user.
  • The ENV line declares an environment variable DISPLAY and sets it to :0. This is not really necessary at this stage, but provides some convenience when running the container. With this line, it will be possible to run the container without specifying the DISPLAY variable when its value would be :0. And DISPLAY is :0 most of the time.
  • The USER user line ensures that subsequent commands (and thus the container) are run as user user.
  • The ENTRYPOINT line specifies that the container should run xeyes. xeyes is not run directly but wrapped with a shell (/bin/sh), so that Ctrl+C will work and stop xeyes. Furthermore, the way how the shell is wrapped, container command arguments will be forwarded to xeyes. That way it will be possible to specify the geometry of the xeyes window, for example.

For more information what these Dockerfile commands mean and how they work, refer to [Dockerfile].

You can build the container with docker build -t my-xeyes

4 Running it

Install X11 Mac

Mac

The first attempt to run the image would look like this:

The error message means that xeyes in the container was unable to connect to the X11 server. There are two to three reasons for this.

  • There is no .Xauthority configured for the user user inside the container.
  • The docker container is running in a separate network, not the host network.
  • The DISPLAY might be something else than :0.

We need to share the current user's .Xauthority with the xeyes docker container. For that, we can simply mount the .Xauthority file as volume. But there's a caveat: The user user inside the container has id 1000. The id of the current user might be different. So we need to grant access to the user user by granting access to 1000.

To grant access, run setfacl -m user:1000:r ${HOME}/.Xauthority. The volume is configured by adding -v ${HOME}/.Xauthority:/home/user/.Xauthority to docker run.

Note what this means. Such volumes are file system sharing between the host and the container. For such shared file systems, the user ids between the container and the host need to match.

These steps alone will not yet work. The .Xauthority file is shared successfully, but X11 will still deny access. The reason is that the docker container thinks it's a different machine than what was configured automatically in the .Xauthority during login. You can change what the docker container thinks of networks. Add the option --net=host to the docker run command.

To see the full command sequence, look at the next chapter, which shows a shell script for convenience.

5 Shell Script for Convenience

The following shell script contains all the commands to run xeyes in docker.

5.1 Explanation of the Shell Script

  • The setfacl command grants read access to the current host user's .Xauthority file to user 1000. User 1000 is the user which was created in the container by the Dockerfile. This read access is needed so that the container's user can access the .Xauthority file. The .Xauthority contains the X11 session credentials cookie which is used to authenticate connections to the X11 display server.
  • The docker build command builds the image from the Dockerfile and stores it in the local registry under the name my-xeyes.
  • The exec docker run command replaces the current shell with docker. The docker run my-xeyes command runs a docker container from the previously created docker image my-xeyes. Options and Arguments explained:
    • -it (interactive terminal) tells Docker to run an interactive terminal. This way, the container will behave like a command in the current shell.
    • --rm (remove) tells Docker that the container will not be needed after it stopped and thus can be deleted automatically.
    • --name xeyes gives the Docker container a name for reference by other Docker commands. This is probably not needed in this case, but still helpful.
    • --net=host configures the network of the Docker container to use the host network. This is the simplest way to get access to X11.
    • -e DISPLAY forwards the DISPLAY environment variable to the container. That variable contains the information about which display server to use. Mind you, that Unix systems could in theory run multiple display servers in parallel.
    • -v $(HOME}/.Xauthority:/home/user/.Xauthority makes the current host user's .Xauthority file visible to the user user in the Docker container.
    • my-xeyes is the name of the image from which to create the container. It is the name of the image used in the previous docker build command.
    • '$@' forwards the command line arguments to the container.

5.2 Examples

  • ./xeyes_in_docker.sh
  • ./xeyes_in_docker.sh -geometry 1000x500

6 Limitations and Alternatives

Mac X11 App

As already mentioned, there is a security consideration around X11 applications. Besides, this solution only works in situations where the host runs X11 directly. This means success is almost guaranteed if the host that runs docker runs X11 itself. That is the case on Linux and FreeBSD. On other operating systems, such as Mac OS X and Windows, further steps would be required.

Heroes of might magic 6 for mac Since it was launched in the mid 90's, Heroes of Might of Magic, spin-off of the original Might and Magic games, became one of the reference sagas in what regards to turn-based strategy games, managing to reach the first position for fantasy games of this genre.

Applications

There are at least two options in that case.

  • Using X11 with more effort. If you use X11 on Mac OS X or Windows, you can still get this to run. But you will need to modify the DISPLAY environment variable, and potentially do other things as well, maybe using xauth or xhost.
  • Use VNC.

Everyone already knows that Mac OS X is a Unix variant and that it can run Unix software. Many just leave it at that, assuming that Unix software means things that run in the Terminal – but there’s also a whole wide world of graphical apps in the Unix world that run in what’s known as the X11 environment.

The problem is that not many in the Mac community – beyond the übergeeks – seem to know or understand what X11 is.

Fortunately, Apple has made it easy to install and use X11 in a near seamless fashion on your Mac. With a little guidance, it’s pretty easy to be up and running with a bunch of free apps that are well-known to those in the Linux and Unix world.

X11 is the flagship product of X.Org Foundation and simply provides a method for Unix systems to draw windows, mouse pointers, and other standard elements of a graphical user interface (GUI).

Without X11, using a Unix or Linux system is totally a command-line affair.

What Is X11?

X, as it was originally known, was first developed at MIT in 1984. (Probably not coincidentally, this is the same year the first Mac debuted, starting the GUI revolution.) By 1987, it had developed into X11, and it hasn’t changed a whole lot since, beyond being updated for newer video cards and the like.

X11 operates on a client-server methodology. Basically, the X server serves up graphical content and an X client draws the windows and accepts mouse and keyboard input. For nearly all its uses these days, the server and the client are running on the machine, providing Linux distributions everywhere with a fully graphical environment.

After the Mac OS transitioned to a Unix base when OS X debuted in 2001, it was only a matter of time before X11 was up and running on the Mac. But X11 had actually been there long before. X11 clients for the Mac have existed since the late 1980s. Tenon’s MachTen provided a full Unix environment for 680×0 and early PowerPC Macs, including a bundled X client and server. (Tenon later morphed this product into iTools, which provides a nice graphical front end for the Unix/server parts of OS X.)

Apple’s mid-1990s Unix, A/UX, also shipped with an X11 client and server.

X11 on OS X

Getting X11 up and running with Mac OS X 10.0 meant compiling it from source code. Although this was a snap for veteran Unix admins, it would take a while before the idea took off on the Mac. Flash-forward 18 months, and the process got a lot easier in the era of Mac OS X 10.2. A package installer for X11 surfaced from X.Org, and a new third-party app named XDarwin made it easy to run X11 apps alongside OS X’s Aqua ones (or run X11 in its full-screen “rootless” mode).

Not long after, Apple started shipping a beta of its own package simply named X11, combining both the X11 framework and a client very similar to XDarwin.

Since OS X 10.3, X11 has been quick and easy to get up and running, and thus there’s been a lot more interest in the Mac community.

Is it worth downloading X11 for 10.3 (or installing from your Tiger install disc for 10.4 users)?

There a few good reasons, and since we’re in the realm of free software, it won’t cost you anything but some time.

Reason #1: Free software

There’s a ton of free, open source software that runs under X11 on Unix/Linux systems, and with a little bit of recompiling they can easily run on OS X, too. If compiling software is a deal-killer for you, don’t worry, because somebody else has already done the work for you.

X11

Fink and DarwinPorts are two incredible projects with the common goal of porting Unix software to Mac OS X. Installing either one of these makes it a breeze to get a ton of free software on your system.

For newcomers, I’d recommend Fink, if only because of it’s wonderful bundled GUI companion, FinkCommander. With FinkCommander in hand, it’s a point-and-click affair to find the type of software you’re looking for and get it installed on your Mac.

Although Fink has a package installer and is really easy to get up and running, follow the instructions closely. In particular, make sure you download the Fink that’s right for your OS and install the X11 SDK from your X11 installer (either downloaded or on the Tiger DVD).

Once you have your software installed, type the program’s full path in X11’s terminal window. For example, to open the Bluefish editor I installed with Fink, I type:

(The “&” backgrounds the bluefish process, so that I don’t have to leave the terminal window open to keep Bluefish up and running.)

The downside to this is having to know the full path of an application’s command. Fortunately, fink installs almost everything in /sw/bin/. You can use X11’s built-in menu editor to add shortcuts to the the Application menu and not have to type the commands every time.

It’s also possible to download packages that utilize X11 but require no typing of commands to launch. One such fantastic package is Gimp.app, which makes installing and running the popular open-source image editor a snap. Just double-click its icon, X11 opens, and then Gimp opens up.

Reason #2: Run Apps on Other Systems

Going back to its client-server methodology, X11 can serve apps over the network using a standard SSH connection.

In a typical SSH connection, you would type something like the following to get a remote terminal connection:

X11 applications mac os x

X11 Utility Mac

To forward X11 from that SSH connection, use the following for OS X 10.3:

Or, for OS X 10.4:

Now you will have a session opened on the remote machine. Just type in an X11 application’s command, and it will open in your Mac’s X11 environment.

In my day job, I work with an assortment of Linux systems, and running these apps quickly and securely over the network on my PowerBook is a real joy. It beats using a VNC (virtual network computing) client or standing at the console in the server room any day.

This also opens up possibilities for the home user who’d like to try Linux. Linux can run on an old box in your closet while you try out the apps on the laptop from your couch.

Reason #3: Run a Different Desktop Environment

A little bored with OS X and Aqua? With X11, it’s possible to run an entirely different desktop environment on your Mac. This includes the ever-popular K Desktop Environment (KDE), which along with Gnome is one of the leaders in Linux graphical environments.

X11 Application For Mac

Fink can get you a working KDE installation, and there are quite a few other methods to get to the same place. Googling for “KDE Mac OS X install” will bring up quite a few pages for research, but those actually inclined to run KDE on their Mac will probably enjoy the challenge (and master it quite easily).

Further Reading

  • Preparing for Scribus: Working with X11 and FinkCommander, Jason Walsh, Low End Designer

Keyword: #x11

Short link: http://goo.gl/q7XMSO

Mac X11 Client

searchword: x11

X11 Applications Mac Os X

Related