プログラムを、関数や型に応じて、魔法陣の画像に変換する Mystical を Windows で実行する手順を紹介します。
PostScript 言語で記述された Mystical を実行するための Ghostscript のコマンドのオプションなどの具体例も紹介します。
※環境構築の後の、後半の章は、試しながらわかったことを記述している部分もあるので、我流の手順とその結果としてお読みください。

※ gs10.05.1 を使用します。
※ 2025 年 05 月 24 日に GitHub で公開されている mystical_ps, dmmlib リポジトリの複製を使用しています。
Mystical とは
Mystical は PostScript プログラムを魔法陣の画像に変換します。
Mystical でサポートしている特定の関数・型が、対応する魔法陣として配置されます。
I wanted to make a programming language that resembled magical circles. This is more like a way to write PostScript that looks like a magical circle, but I will refer to it as Mystical in this document.
魔法陣のようなプログラミング言語を作りたいと思っていました。これは魔法陣のような PostScript の書き方に似ていますが、本書ではこれを「神秘的」と呼びます。denismm/mystical_ps と Google 翻訳
現時点では、プログラムを魔法陣の画像に変換できますが、魔法陣の画像をプログラムとして動作させることはできません。
At the moment it’s a way to draw a PostScript program – there’s no interpreter that will ingest a Mystical image and perform the appropriate computation. It could be run and interpreted by a human, or (more likely) a human could read it and turn it into a PostScript program and run that. I’ll leave further philosophical arguments to other people for now.
現時点では、これは PostScript プログラムを描画する方法です。Mystical イメージを取り込んで適切な計算を実行するインタプリタはありません。人間が実行して解釈することもできますし、(おそらく) 人間がそれを読み取って PostScript プログラムに変換して実行することもできます。これ以上の哲学的な議論は今のところ他の人に任せます。denismm/mystical_ps と Google 翻訳
プログラムが魔法陣に変わるだけでも十分 Mystical (神秘的)だと筆者は思ったので、難しかったですが、なんとか Windows 環境で実行する手順を見つけました。
以下は、その手順です。
Git for Windows の導入
git clone コマンドで GitHub で公開されている denismm/mystical_ps, denismm/dmmlib: Library of convenient postscript functions の各リモートリポジトリをローカルのフォルダに複製します。
※事前に、 GitHub にログインしておく必要があります。
※ GitHub の Code ボタンを押すと表示される Download ZIP から zip でダウンロードすることもできますが、次の dmmlib のクローンでは git コマンドを使う必要があるので、 Git for Windows は必要になります。
Git for Windows の導入については以下の記事を参照してください。
mystical リポジトリのダウンロード
GitHub の denismm/mystical_ps にアクセスしたら、Code ボタンを押して表示されるポップアップで Copy ボタンを押して、 https:// ~ .git の URL をコピーします。
この URL を git clone コマンドの引数に指定することで、リモートリポジトリの内容をローカルに複製できます。
リポジトリを新しいディレクトリにクローンする
Git – git-clone Documentation

後で dmmlib リポジトリを複製する際に、その要素のシンボリックリンクを作成するために、管理者権限で git clone コマンドを実行します。
コマンドプロンプトを管理者権限で起動します。
Windows 10 の場合は、デスクトップの左下の検索ボックスに cmd と入力してから、検索された「コマンドプロンプト システム」の「管理者として実行」リンクをクリックしても、管理者権限でコマンドプロンプトを起動できます。

「管理者として実行」を指定して起動したコマンドプロンプトのタイトルに「管理者」と表示されています。
cd コマンドで複製を配置したいフォルダまで移動します。
ドライブが異なる場合は /d を付けて、ドライブ名:\ からパスを指定します。
git clone コマンドで、先ほど GitHub の denismm/mystical_ps で取得した URL を引数に加えて実行します。
※ GitHub へのログインダイアログが表示された場合は、GitHub にサインインすることで、 clone コマンドを続行できます。
git clone https://github.com/denismm/mystical_ps.git

フォルダにクローンできたら、そのフォルダに cd コマンドで移動して、 git status コマンドで正常にリポジトリが複製されたことを確認しましょう。
「nothing to commit, working tree clean」ならば問題ありません。
Show the working tree status
Displays paths that have differences between the index file and the current HEAD commit, paths that have differences between the working tree and the index file, and paths in the working tree that are not tracked by Git (and are not ignored by gitignore[5]). The first are what you would commit by running
git commit
; the second and third are what you could commit by running git add before runninggit commit
.作業ツリーのステータスを表示するGit – git-status Documentation
インデックス ファイルと現在の HEAD コミットの間に差異があるパス、作業ツリーとインデックス ファイルの間に差異があるパス、Git によって追跡されない (gitignore[5] によって無視されない) 作業ツリー内のパスを表示します。 1 つ目は、git commit を実行してコミットする内容です。 2 番目と 3 番目は、git commit を実行する前に git add を実行することでコミットできるものです。
Microsoft Windows [Version 10.0.19045.5854]
(c) Microsoft Corporation. All rights reserved.
C:\Windows\system32>cd /d G:\Dev\Mistical
G:\Dev\Mistical>git clone https://github.com/denismm/mystical_ps.git
Cloning into 'mystical_ps'…
remote: Enumerating objects: 866, done.
remote: Counting objects: 100% (536/536), done.
remote: Compressing objects: 100% (386/386), done.
remote: Total 866 (delta 226), reused 429 (delta 126), pack-reused 330 (from 1)
Receiving objects: 100% (866/866), 1.16 MiB | 7.99 MiB/s, done.
Resolving deltas: 100% (380/380), done.
G:\Dev\Mistical>cd mystical_ps
G:\Dev\Mistical\mystical_ps>git status
On branch main
Your branch is up to date with 'origin/main'.
nothing to commit, working tree clean
G:\Dev\Mistical\mystical_ps>
dmmlib リポジトリをシンボリックリンクに対応した git clone で配置
Mystical を動作させるには、別のリポジトリ dmmlib を mystical_ps フォルダの下に配置する必要があります。
今度は GitHub の denismm/dmmlib: Library of convenient postscript functions にアクセスして、先ほどと同様に GitHub のページで Code ボタンを押して表示されるポップアップから dmmlib の .git の URL をコピーします。

注意点として、 dmmlib にはシンボリックリンクがいくつかあるため、それを Windows 環境でも作成する必要があります。
そのためには以下が重要です。
- コマンドプロンプトを管理者権限で開くこと
- -c core.symlinks=true を git clone コマンドのオプションに追加すること
詳しくは、以下の記事を参照してください。
dmmlib を配置する場所は mystica_ps フォルダの下なので、そこにいることを確認しましょう。
シンボリックリンクは移動してしまうとファイルに変わってしまうので、最初に配置する場所に移動しておくことが重要です。
※先ほど cd コマンドで移動して git status コマンドで確認した状態ならば、移動する必要はありません。
git clone コマンドに -c core.symlinks=true オプションを追加して、そのあとに、dmmlib の .git の URL を貼り付けて実行しましょう。
git clone -c core.symlinks=true https://github.com/denismm/dmmlib.git
実行して dmmlib を mystical_ps フォルダの下に複製したら、 cd dmmlib で作成された dmmlib フォルダに移動して、 git status コマンドで dmmlib リポジトリに異常がないことを確認しましょう。
「nothing to commit, working tree clean」ならば問題ありません。

G:\Dev\Mistical\mystical_ps>git clone -c core.symlinks=true https://github.com/denismm/dmmlib.git
Cloning into 'dmmlib'...
remote: Enumerating objects: 417, done.
remote: Counting objects: 100% (210/210), done.
remote: Compressing objects: 100% (126/126), done.
remote: Total 417 (delta 122), reused 166 (delta 80), pack-reused 207 (from 1)
Receiving objects: 100% (417/417), 859.91 KiB | 6.46 MiB/s, done.
Resolving deltas: 100% (218/218), done.
G:\Dev\Mistical\mystical_ps>cd dmmlib
G:\Dev\Mistical\mystical_ps\dmmlib>git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
GhostScript の導入
mystical.ps などの PostScript を Windows で実行させるため、 GhostScript の Windows 版を導入します。
それについては、以下の記事を参照してください。
Path 環境変数を通さないとコマンドプロンプトから呼び出しにくいので、以下の記事の環境変数の設定の部分も行ってください。
公式に沿った魔法陣の画像生成はこちら
前章までで Mystical を実行する環境はできました。
公式に沿った魔法陣の画像生成については、以下の記事を参照してください。
以降の章は、調べている際に我流で魔法陣の画像を出力した手順です。
行った結果が何かの役に立つかもしれないので記載します。
GhostScript でサンプルの example.ps を実行
mystical_ps, dmmlib を複製して、GhostScript も利用できるようにしたら、mystical_ps フォルダにある example.ps を引数にして mystica.ps を実行して、 example.ps から魔法陣の画像を作成してみましょう。
cd コマンドで mystical_ps フォルダに移動します。
※ dmmlib フォルダから上位に移動するには cd .. と入力してください。
その後、以下のコマンドを入力します。
gswin64c は Windows (64bit) 環境で動作する GhostScript の実行形式のファイル名です。
-sOutputFile オプションで output.png ファイルを出力するように指定しています。
gswin64c -dNOSAFER -sDEVICE=png16m -sOutputFile=output.png mystical.ps examples.ps

以下のメッセージの後、 Enter キーを押します。
>>showpage, press <return> to continue<<
その後 quit⏎ で gswin64c を終了します。
G:\Dev\Mistical\mystical_ps\dmmlib>cd ..
G:\Dev\Mistical\mystical_ps>gswin64c -dNOSAFER -sDEVICE=png16m -sOutputFile=output.png mystical.ps examples.ps
GPL Ghostscript 10.05.1 (2025-04-29)
Copyright (C) 2025 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Querying operating system for font files...
Can't find (or can't open) font file %rom%Resource/Font/%rom%Resource.
Can't find (or can't open) font file Zapf-Chancery.
Didn't find this font on the system!
Substituting font ZapfChancery-MediumItalic for Zapf-Chancery.
Loading Z003-MediumItalic font from %rom%Resource/Font/Z003-MediumItalic... 3484824 2160642 3160312 1863351 1 done.
>>showpage, press <return> to continue<<
GS>quit
G:\Dev\Mistical\mystical_ps>
mystical_ps フォルダに、output.png ファイルが出力され、開くと下図のように魔法陣の画像が作成されました。

紹介した gswin64c コマンドで mystical.ps を使用する際の -dNOSAFER や -c オプションの必要性などについては、以下の記事を参照してください。
訂正
紹介した以下のコマンドでも、魔法陣の画像をファイルに保存できます。
gswin64c -dNOSAFER -sDEVICE=png16m -sOutputFile=output.png mystical.ps examples.ps
しかし、examples.ps の内部で mystical.ps を用いているため、 mystical.ps を指定する必要はありませんでした。
以下のコマンドで、Ghostscript Image ウィンドウに、生成した魔法陣の画像が表示できます。
gswin64c -dNOSAFER examples.ps
以下のコマンドで、生成した魔法陣の画像を output.png ファイルに保存できます。
gswin64c -dNOSAFER -sDEVICE=png16m -sOutputFile=output.png examples.ps
まとめ
今回は、プログラムを、関数や型に応じて、魔法陣の画像に変換する Mystical を Windows で実行する手順を紹介しました。
PostScript 言語で記述された Mystical を実行するための Ghostscript のコマンドのオプションなどの具体例も紹介しました。
参照サイト Thank You!
- denismm/mystical_ps
- denismm/dmmlib: Library of convenient postscript functions
- Git
- Git – git-clone Documentation
- Git – git-status Documentation
- Ghostscript
- 魔法陣のようなプログラミング言語「Mystical」 – GIGAZINE
記事一覧 → Compota-Soft-Press
コメント