It is Christmas soon. So I'm going to snow (or penguins) on my Mac. (I couldn't think of much to write, so I decided to make the tea muddy.)
Those who have no idea what the title is. If you can predict what it is, you probably agree with it, so you don't have to read it.
Do the following: (It is assumed that the OS is macOS Mojave, Homebrew and Docker are installed, and Docker is running.)
Open a terminal and do the following:
$ brew update && brew cask install xquartz
#You may need to enter your password along the way
# "xquartz was successfully installed!"Is displayed, the process is complete.
$ sudo launchctl load -w /Library/LaunchAgents/org.macosforge.xquartz.startx.plist
#When prompted for a password, enter it
$ open /Applications/Utilities/XQuartz.app
If all goes well, an application called XQuartz will start, so change the settings.
Set as follows.
Log out and log in again for the settings to take effect.
Now that the preparation is complete, let's run it. In the terminal do the following:
$ git clone https://github.com/hirota745/snow-falls.git
$ cd snow-falls
$ sh fall.sh
#If you want to drop penguins instead of snow$ sh fall.sh penguin
After doing the above, wait a few minutes.
If all goes well, the screens will switch and it should snow. Congratulations. (By the way, if you wait for a while, snow will pile up and the wind will blow, so it may be good to watch it.)
If the screen doesn't switch, press Command + tab several times to switch to XQuartz. If the screen still does not change, select the following from the menu.
Select the following from the menu to cancel full screen. (The menu is displayed when you move the mouse cursor to the top of the screen.) (Sometimes XQuartz itself may crash, but I want to quit it so I think it's okay to ignore it.) Then type Ctrl-c in the terminal to quit.
If you want to run it again, do the following in your terminal:
$ sh fall.sh
#If you want to drop penguins instead of snow$ sh fall.sh penguin
It's not good that there is no explanation, so I will explain how it works a little.
The first running application itself is an application called xsnow (xpenguins for penguins). These are running on Linux (maybe you could run them directly on your Mac, but I haven't tried them). If you install Linux directly on your computer or install Linux on Virtualbox, you can view and operate GUI applications on the Linux screen in the same way as Windows and Mac. If you want to run a GUI application on Linux, you need something called X Server (the GUI application itself is a Client that communicates with X Server), and usually this X Server itself also runs on Linux. (Figure below)
The X Server itself does not have to be running on the machine running the Client application, it does not matter if it is running on another machine. In this configuration, Linux is running on Docker on a Mac (Debian is running), and the Client application (xsnow) is running on that Linux. However, X Server runs on a Mac, and a Client application running on Linux connects to it. This makes it look like xsnow is running directly on your Mac. (Figure below)
The "Client App" in the figure can be anything, for example Firefox or Emacs can work as well. In the case of these applications, unlike xsnow that I moved this time, it operates in a separate window, so it is not necessary to set the full screen mode set in the "Output" tab of XQuartz. By doing so, you can view and operate applications running on Linux on the same screen as other Mac applications (Finder etc.) running directly on the Mac, making it more like running on the Mac. I can see it.
It may not be in great demand, but I ran a GUI application on Linux and displayed it on a Mac. Nowadays, you can run Linux relatively easily anywhere using Docker etc., but usually you log in to Linux from a terminal etc. instead of running a GUI application and work from the command line there. think. If you combine it with X Server as I tried this time, you can run Linux GUI applications as if they were running on your usual OS. You may want to take this opportunity to try using a Linux GUI application as well.
Recommended Posts