While installing and running GTKWave is straightforward on MacOS, it is slightly more difficult to get the command line tool running properly.
One conventional approach is to use
alias gtkwave = open -a gtkwave;
however, this is lacking because it does not accept command line
arguments. Even using
--args to pass arguments does not work. This
post demonstrates how to get it working using the
First, install GTKWave:
brew tap homebrew/cask brew cask install gtkwave
Although you can try just running the executable now, it will run into an error if Perl’s Switch module is not installed. This is done in the next section.
Using Perl’s package manager, install Switch:
cpan install Switch perl -V:'installsitelib'
The last command prints out the location of where Switch is installed. If it is something like
/usr/local/Cellar/perl/..., then Switch must be coppied to the correct location in
sudo cp /usr/local/Cellar/perl/5.*/lib/perl5/site_perl/5.*/Switch.pm /Library/Perl/5.*/
Finally, the GTKWave command line tool can be run without any errors:
Add the command to ~/.bash_profile:
Now this can be added to the
alias gktwave = /Applications/gtkwave.app/Contents/Resources/bin/gtkwave
export PATH= /Applications/gtkwave.app/Contents/Resources/bin/:$PATH
From the manual (section: Compiling and Installing GTKWave):
Note that if running GTKWave on the command line out of a precompiled bundle gtkwave.app, it is required that the Perl script gtkwave.app/Contents/Resources/bin/gtkwave is invoked to start the program.