GTKWave on macOS

Motivation

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 /Applications/gtkwave.app/Contents/Resources/bin/gtkwave executable.

Install

GTKWave

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.

Perl Switch

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 /Library/Perl/5.*/:

sudo cp /usr/local/Cellar/perl/5.*/lib/perl5/site_perl/5.*/Switch.pm /Library/Perl/5.*/

Run

Finally, the GTKWave command line tool can be run without any errors:

/Applications/gtkwave.app/Contents/Resources/bin/gtkwave

Add the command to ~/.bash_profile:

Now this can be added to the ~/.bash_profile with:

alias gktwave = /Applications/gtkwave.app/Contents/Resources/bin/gtkwave

or with:

export PATH= /Applications/gtkwave.app/Contents/Resources/bin/:$PATH

Helpful References

  1. A hacking attempt
  2. A conventional approach for reference only
  3. The Manual

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.