[LINUX] Snow on your Mac the old-fashioned way

Introduction

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.)

Target audience

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.

procedure

Do the following: (It is assumed that the OS is macOS Mojave, Homebrew and Docker are installed, and Docker is running.)

Installation and configuration of XQuartz

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. pref.png

Set as follows. output.png security.png

Logout & login

Log out and log in again for the settings to take effect.

Run

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. fullscreen.png

How to exit

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.) fullscreen.png (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

How it works

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) x1.png

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) x2.png

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.

Summary

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.

reference

Recommended Posts

Snow on your Mac the old-fashioned way
Steps to install the latest Python on your Mac
Install numba on your Mac
Install Django on your Mac
Create a python environment on your Mac
Put Anaconda on your Mac using Pyenv
LightGBM All parameter explanation (on the way)
I tried to use Resultoon on Mac + AVT-C875, but I was frustrated on the way.
Build a Python development environment on your Mac
python on mac
Introduction to Python with Atom (on the way)
Until you install Anaconda for data analysis on your Mac and launch the IDE
I tried Python on Mac for the first time.
Set up a simple local server on your Mac
Build a Python environment on your Mac using pyenv
Post to your account using the API on Twitter
Install Tensorflow on Mac
Install pyenv on mac
Pyenv + virtualenv on Mac
Install Ansible on Mac
Install Python on Mac
Install Python 3 on Mac
numba installation on mac
Run OpenMVG on Mac
Install Python 3.4 on Mac
Install Caffe on Mac
Install mecab on mac
Install mecab-python on Mac
Try deepdream on Mac
Count the number of characters in the text on the clipboard on mac
I made a VGG16 model using TensorFlow (on the way)
Install the latest version of Git on your Linux server
Make Pandas available on Jupyter in the shortest possible time on your new Mac without polluting the environment