X11 Applications For Mac

Posted on  by 



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. 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. To Paste between an X11 app and a Mac OS X app, in the X11 file menu, select Edit Copy and then select Edit Paste in the Mac OS X app menu. X11 Customization and PATH export: To have the scrollbar automatically appear when a new xterm window is created from the X11 menu (and to perhaps source the shell files so that PATH's are kept, etc). Before proceeding make sure that you have installed both PuTTY and xming. These are installed on the ENGR lab images but are probably not installed on your personal laptop.First you will want to start PuTTY and enter the following information:SessionHost Name (or IP address): serveraddress (ex. Flop.engr.oregonstate.edu)Connection type: SSH xming1.png ConnectionSSHX11X11. X11R6 Basics Hello World Basic Programming Knowledge about X11. If you want to run for example 2D vector application like InkScape (on your Mac you need to install X11.How to install X11R6 (and InkScape) on your Mac.

  1. X11 Utility Mac
  2. Mac X11 App
  3. Mac X11 Client

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

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.

What is x11 on mac

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

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

X11 Utility Mac

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.

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.
(Redirected from X11.app)
XQuartz (X11.app)
Developer(s)Jeremy Huddleston Sequoia, X.Org Foundation, Apple Inc.
Stable release
Written inC
Operating systemmacOS
TypeDisplay server
LicenseApple Public Source License
MIT License
Websitewww.xquartz.org

Mac X11 App

XQuartz is an open-source version of the X.Org X server, a component of the X Window System (X11, or shortened to simply X, and sometimes informally X-Windows) that runs on macOS.[1] It formally replaced Apple's internal X11 app. The name 'XQuartz' derives from Quartz, part of the macOS Core Graphics framework, to which XQuartz connects these applications. XQuartz allows cross-platform applications using X11 for the GUI to run on macOS, many of which are not specifically designed for macOS. This includes numerous scientific and academic software projects.[2]

History[edit]

Mac X11 Client

Applications

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 dropped dedicated support for X11.app, with users being directed to the open source XQuartz project (to which Apple contributes) instead.[2]

In Mac OS X 10.4 Tiger, Apple's X11 implemented X11 protocol release 6.6 (X11R6.6). This implementation includes an XFree86 4.4 based X11 window server, Quartz rootless window manager, libraries, and basic utilities such as xterm.[3] 'Rootless' means that X window applications show up on the Quartz desktop, appearing like any other windowed Quartz application (that is, not in a virtual desktop contained within another window). In Mac OS X Leopard, X11 was updated to use X.Org Server (X11R7.2) rather than XFree86.[4] The source code for X11 is available from Apple. Some source code is available under the Apple Public Source License while the bulk is licensed under the MIT License.

Current version[edit]

The current version of XQuartz is a DDX (Device Dependent X[5]) included in the X.Org Server and implements support for hardware-accelerated 2D graphics (in versions prior to 2.1), hardware OpenGL acceleration and integration with Aqua, the macOS graphical user interface (GUI). As of version 2.7.11, XQuartz does not provide support for high-resolution Retina displays to X11 apps, which run in pixel-doubled mode on high-resolution displays.

List of versions (since 2010)[edit]

Version[6]macOS RequirementMost important changesRelease date
XQuartz 2.7.11Mac OS X Snow Leopard 10.6.3 or later2016-10-29
XQuartz 2.7.10Mac OS X Snow Leopard 10.6.3 or later2016-10-22
XQuartz 2.7.9Mac OS X Snow Leopard 10.6.3 or later2016-05-05
XQuartz 2.7.8Mac OS X Snow Leopard 10.6.3 or laterFirst release supported on OS X El Capitan2015-10-17
XQuartz 2.7.7Mac OS X Snow Leopard 10.6.3 or laterFirst release supported on OS X Yosemite2014-08-18
XQuartz 2.7.6Mac OS X Snow Leopard 10.6.3 or later2014-05-17
XQuartz 2.7.5Mac OS X Snow Leopard 10.6.3 or laterFirst release supported on OS X Mavericks2013-11-10
XQuartz 2.7.4Mac OS X Snow Leopard 10.6.3 or later2012-09-27
XQuartz 2.7.3Mac OS X Snow Leopard 10.6.3 or later2012-08-27
XQuartz 2.7.2Mac OS X Snow Leopard 10.6.3 or laterFirst release supported on OS X Mountain Lion2012-06-01
XQuartz 2.7.1Mac OS X Snow Leopard 10.6.3 or later2012-06-01
XQuartz 2.7.0Mac OS X Snow Leopard 10.6.3 or laterFirst release supported on Mac OS X 10.7 Lion2011-11-04
XQuartz 2.6.3Mac OS X Snow Leopard 10.6.3 or later2011-07-20
XQuartz 2.6.2Mac OS X Snow Leopard 10.6.3 or later2011-04-30
XQuartz 2.6.1Mac OS X Leopard 10.5.8, Mac OS X Snow Leopard 10.6.3, or later2011-03-17
XQuartz 2.6.0Mac OS X Leopard 10.5.8, Mac OS X Snow Leopard 10.6.3, or later2010-12-19
XQuartz 2.5.3Mac OS X Leopard 10.5.8, Mac OS X Snow Leopard 10.6.3, or later2010-08-13
XQuartz 2.5.2Mac OS X Leopard 10.5.8, Mac OS X Snow Leopard 10.6.3, or later2010-07-20
XQuartz 2.5.1Mac OS X Leopard 10.5.8, Mac OS X Snow Leopard 10.6.3, or later2010-07-10
XQuartz 2.5.0Mac OS X Leopard 10.5.8, Mac OS X Snow Leopard 10.6.3, or laterFirst release supported on Mac OS X Snow Leopard2010-03-29

See also[edit]

  • MacX, X11 support on Classic Mac OS
  • XWayland, to support X application under Wayland
  • XDarwin, an implementation of X for macOS that preceded XQuartz, and supports versions of macOS before 10.3 unlike XQuartz

References[edit]

  1. ^'XQuartz'.
  2. ^ ab'Apple Removes X11 in OS X 10.8 Mountain Lion, Shifts Support to Open Source XQuartz'. Retrieved September 14, 2016.
  3. ^'XQuartz'. September 14, 2016.
  4. ^'Inside Leopard: Under-the-hood, Page 2'. Macworld. November 2, 2007. Retrieved June 30, 2020.
  5. ^'Glossary'. www.x.org. Retrieved September 15, 2016.
  6. ^'XQuartz - Releases Archive'. www.xquartz.org. Retrieved January 22, 2017.

External links[edit]

Retrieved from 'https://en.wikipedia.org/w/index.php?title=XQuartz&oldid=965383144'




Coments are closed