TABLE OF CONTENTS (HIDE)

M1 MacBook Air Package Installation

Important note: Do not translate this page into Japanese with Google translation; otherwise there will be many execution errors.

Open a terminal

Finder -> Applications -> Utilities -> Terminal
zsh.png
yamin@mac ~ % uname -m
arm64
yamin@mac ~ % sw_vers
ProductName:            macOS
ProductVersion:         13.2.1
BuildVersion:           22D68
yamin@mac ~ % echo $HOME
/Users/yamin
yamin@mac ~ % echo $path
/usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin
yamin@mac ~ % echo $SHELL
/bin/zsh

Install Homebrew

Copy the following command from https://brew.sh/
yamin@mac ~ % /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
yamin@mac ~ % (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> $HOME/.zprofile
yamin@mac ~ % eval "$(/opt/homebrew/bin/brew shellenv)"
yamin@mac ~ % echo $path                                                                
/opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin
yamin@mac ~ % echo 'export GNUTERM="qt font \"Arial,12\""' >> $HOME/.zprofile

Install emacs

yamin@mac ~ % cat>.emacs.el
Add the followings to .emacs.el
(set-language-environment "Japanese")
(prefer-coding-system 'utf-8)
(package-initialize)
(tool-bar-mode 0)
(setq-default indent-tabs-mode nil)
(setq c-basic-offset 4 indent-tabs-mode nil)
(custom-set-variables
 '(verilog-align-ifelse t)
 '(verilog-auto-delete-trailing-whitespace t)
 '(verilog-auto-inst-param-value t)
 '(verilog-auto-inst-vector nil)
 '(verilog-auto-lineup (quote all))
 '(verilog-auto-newline nil)
 '(verilog-auto-save-policy nil)
 '(verilog-auto-template-warn-unused t)
 '(verilog-case-indent 4)
 '(verilog-cexp-indent 4)
 '(verilog-highlight-grouping-keywords t)
 '(verilog-highlight-modules t)
 '(verilog-indent-level 4)
 '(verilog-indent-level-behavioral 4)
 '(verilog-indent-level-declaration 4)
 '(verilog-indent-level-module 4)
 '(verilog-tab-to-comment t)
 '(inhibit-startup-screen t)
 '(tex-suscript-height-ratio 1.0))
(set-frame-size (selected-frame) 120 60)
(set-face-background 'default "#f0ffff")
(setq-default tab-width 4)
(setq-default ispell-program-name "aspell")
(with-eval-after-load "ispell"
  (setq ispell-local-dictionary "en_US")
  (add-to-list 'ispell-skip-region-alist '("[^\000-\377]+")))
(define-key global-map [?¥] nil)
(define-key local-function-key-map [?¥] [?\\])
Control + D to exit
yamin@mac ~ % brew install --cask emacs
yamin@mac ~ % brew install aspell
yamin@mac ~ % emacs .emacs.el &
emacs_el.png

Install XQuartz and tgif

yamin@mac ~ % brew install XQuartz
Logout and login again
yamin@mac ~ % brew install tgif
yamin@mac ~ % tgif tgif_ex.obj &
Draw a diagram like the one below, or import tgif_ex.obj
tgif.png
Control + s, Control + p

Install gnuplot

yamin@mac ~ % brew install gnuplot
Download gnu_plot_data.gnu and gnu_plot_latency.dat
If gnu_plot_data.gnu was saved as gnu_plot_data.gnu.txt, run
yamin@mac ~ % mv gnu_plot_data.gnu.txt gnu_plot_data.gnu
yamin@mac ~ % cat gnu_plot_latency.dat
yamin@mac ~ % emacs gnu_plot_data.gnu &
yamin@mac ~ % gnuplot gnu_plot_data.gnu
yamin@mac ~ % open gnu_plot_data.pdf

Install mactex

yamin@mac ~ % brew install --cask mactex
Close your terminal and open a new terminal
yamin@mac ~ % sudo tlmgr update --self --all
yamin@mac ~ % epstopdf tgif_ex.eps
yamin@mac ~ % open tgif_ex.pdf
Download sample.tex
yamin@mac ~ % emacs sample.tex &
yamin@mac ~ % platex sample.tex
yamin@mac ~ % platex sample.tex
yamin@mac ~ % dvipdfmx sample.dvi
yamin@mac ~ % open sample.pdf

Install icarus-verilog

yamin@mac ~ % brew install icarus-verilog
aon.svg
Download and_or_not.v (circuit) and and_or_not_tb.v (test-bench for simulation)
If and_or_not.v was saved as and_or_not.v.txt, and
and_or_not_tb.v was saved as and_or_not_tb.v.txt, run
yamin@mac ~ % mv and_or_not.v.txt and_or_not.v
yamin@mac ~ % mv and_or_not_tb.v.txt and_or_not_tb.v
yamin@mac ~ % emacs and_or_not.v &
emacs-aon-v.png
yamin@mac ~ % iverilog -Wall -o and_or_not and_or_not_tb.v and_or_not.v
yamin@mac ~ % ./and_or_not
VCD info: dumpfile and_or_not.vcd opened for output.
and_or_not_tb.v:12: $finish called at 4 (1ns)

Install gtkwave

yamin@mac ~ % brew install --cask gtkwave
yamin@mac ~ % sudo cpan install Switch
Finder -> Applications -> Control-click gtkwave -> Open
yamin@mac ~ % sudo cpan install Switch
Finder -> Applications -> Control-click gtkwave -> Open
yamin@mac ~ % brew install --HEAD randomplum/gtkwave/gtkwave
yamin@mac ~ % gtkwave and_or_not.vcd
Click and_or_not_tb
Select signals a, b, f_and, f_or, f_not
Click Append button
and_or_not_vcd.png

Install Java

Download JDK ARM64 DMG Installer from https://www.oracle.com and install it.
Download Tetris3D.java, Shape3D.java, and Play3D.java
yamin@mac ~ % emacs Tetris3D.java &
yamin@mac ~ % javac *.java
yamin@mac ~ % java Tetris3D
tetris3d.png
Download tetris3d.jar
yamin@mac ~ % java -jar tetris3d.jar

Use Python3, C, and C++

Use Python3

yamin@mac mac % python3 --version
Python 3.9.6
yamin@mac ~ % emacs endian.py &
emacs-endian-py.png
yamin@mac ~ % python3 endian.py
little

Use C

yamin@mac ~ % emacs hello.c &
emacs-helloe-c.png
yamin@mac ~ % gcc -o hello hello.c
yamin@mac ~ % ./hello
Hello, World!

Use C++

yamin@mac ~ % emacs helloworld.cpp &
emacs-helloe-cpp.png
yamin@mac ~ % g++ -o helloworld helloworld.cpp
yamin@mac ~ % ./helloworld
Hello, World!

Screenshot without shadow

yamin@mac ~ % defaults write com.apple.screencapture disable-shadow -bool true
yamin@mac ~ % killall SystemUIServer
Shift + Command + 4 + Space
mac.png

Convert TGIF Japanese to PDF

tgif2pdf converts a TGIF EPS file to PDF using xelatex and PSTricks. See example below. 
The TGIF file contains Japanese characters, mathematical expressions, and other drawings.
Two types of PDFs are created. One uses gradient colors and one does not.

Details can be found at https://yamin.cis.k.hosei.ac.jp/tgif2pdf/.

Convert GNUPLOT Japanese to PDF

gnuplot2pdf converts a GNUPLOT PS file to PDF using platex and dvipdfmx.
See the converted PDF example that contains Japanese characters and mathematical expressions.

Details can be found at https://yamin.cis.k.hosei.ac.jp/gnuplot2pdf/.