Open a terminal
Finder -> Applications -> Utilities -> Terminal
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 &
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
Control + s, Control + p
Install gnuplot
yamin@mac ~ % brew install gnuplot
yamin@mac ~ % cat>x2x.gnu
Add the followings to x2x.gnu
set yrange [-200:1200] plot x*x, 2**x pause -1 "Type Enter to continue" set terminal pdf set output "x2x.pdf" replot
Control + d
yamin@mac ~ % gnuplot x2x.gnu
yamin@mac ~ % open x2x.pdf
Try again with
set xrange [-7:7] set yrange [-2:30]
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
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 &
yamin@mac ~ % iverilog -Wall -o and_or_not and_or_not_tb.v and_or_not.v
yamin@mac ~ % vvp 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
In case of zsh: command not found: gtkwave then
yamin@mac ~ % brew link gtkwave yamin@mac ~ % gtkwave and_or_not.vcd
When updated to macOS Sequoia 15.0, then
yamin@mac ~ % brew update yamin@mac ~ % brew upgrade yamin@mac ~ % brew uninstall gtkwave yamin@mac ~ % brew untap randomplum/gtkwave yamin@mac ~ % brew install --HEAD randomplum/gtkwave/gtkwave yamin@mac ~ % gtkwave and_or_not.vcd
If all of the above doesn't work, try VSCode-wavetrace.
- Download VSCode and install it:
- Double click the downloaded zip file to unzip it.
- Move "Visual Studio Code.app" to the "Applications" folder.
- Launch VSCode.
- Click the Extensions icon on the left sidebar.
- Search for "wavetrace" and install it.
- Close VSCode and re-launch it.
- File - Open Folder...
- Navigate to the folder where "and_or_not.vcd" is located.
- Open "and_or_not.vcd".
- Click "Add signals" and double click each of input and output signals to see the waveform.
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
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 &
yamin@mac ~ % python3 endian.py little
Visualization with Python: Download time-complexity-log.txt and change the file name to time-complexity-log.py or show time-complexity-log.html
yamin@mac ~ % brew install python-matplotlib
yamin@mac ~ % brew install scipy
yamin@mac ~ % brew install pillow
yamin@mac ~ % python3 time-complexity-log.py
yamin@mac ~ % open time-complexity-log.pdf
Use C
yamin@mac ~ % emacs hello.c &
yamin@mac ~ % gcc -o hello hello.c
yamin@mac ~ % ./hello Hello, World!
Use C++
yamin@mac ~ % emacs helloworld.cpp &
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
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/.