13

I have been using Schemaspy(v5.0) to diagram mySQL(v5.7.11) using Graphviz via Homebrew on my Mac (El Capitan). A recent update to Graphviz(v2.40.1) apparently has broken Schemaspy's ability to generate the relational diagrams.

Writing/graphing summary.....org.schemaspy.util.Dot$DotFailure: 'dot -Tpng:gd 
/Tools/docs/data/project/diagrams/summary/relationships.real.compact.dot 
-o/Tools/docs/data/project/diagrams/summary/relationships.real.compact.png 
-Tcmapx' 
failed with return code 139

To solve this issue, I have tried:

  • uninstall/reinstall graphviz
  • downgrade Graphviz(v2.38 - it was the only version I could find and homebrew didn't have any older versions either) but it hosed my install
  • attempted to run on a colleague's computer with same results
  • tried the new beta version of schemaspy(v6.0-beta3)
  • searched graphviz forums (page crashed), stackoverflow, and general google search.

Looking to figure out how to get this working again.


[Edit] I didn't find a solution to why SchemaSpy/Graphviz stopped working (or wtf "code 139" meant), but I did use a workaround.

  • Install Docker
  • Get mnuessler/schemaspy or similar from hub.docker.com
  • open a volume to your host - it will be used in the docker command
  • run the command below

docker run -it --rm -v /docs/data:/data mnuessler/schemaspy -hq -t mysql -host localhost -u root -p root -db things -o /data/leads

where -v is the volume you opened on your host and -o /data/... is where the output will show up after the run

Shane Funk
  • 133
  • 2
  • 8

7 Answers7

11

By default SchemaSpy expects the dot executable to be in the PATH environment variable. Use this option to explicitly specify where Graphviz is installed.

If you don't want to add it to your PATH, you can use -gv parameter and provide path to where Graphviz is installed.

Update

  • If you're using GraphViz version 2.40.1 on OS X version older than High Sierra, add -renderer :quartz to the commandline.
  • If you're using GraphViz version 2.40.1 on OS X version High Sierra or newer, add -renderer :cairo to the commandline.
Dónal
  • 185,044
  • 174
  • 569
  • 824
rafalkasa
  • 1,743
  • 20
  • 20
  • I installed using homebrew, which places the app in the $PATH, and everything was working just fine until the last Graphviz update. To check: `$ dot -V dot - graphviz version 2.40.1 (20161225.0304)` thanks for the response – Shane Funk Feb 03 '17 at 14:46
  • Additional update - I added the brew path to the schemaspy script: `-gv "/usr/local/Cellar/graphviz/2.40.1/"` and got the same error messages. I'll keep at it - thanks anyhow! – Shane Funk Feb 03 '17 at 15:02
  • This issue happen also for other SchemaSpy user. I try to find where is the bug and try to fix it as soon as possible. Please verify status of this issue on Github https://github.com/schemaspy/schemaspy/issues/33 – rafalkasa Feb 07 '17 at 21:37
  • 6
    It will be work by using -renderer :quartz tested on Mac OS El Capitan with graphviz version 2.40.1 (20161225.0304) – rafalkasa Mar 24 '17 at 14:04
  • Gave the green check for the above comment thanks all for reviewing – Shane Funk Mar 27 '17 at 15:19
  • I'm running on mojave, graphviz 2.40.1 and tried using brew to install graphviz. the pango libraries were missing in the brew install (they were removed in latest version of graphviz), ultimately had to switch to macports installation of graphviz in order to get schemaspy to work. – rcheuk Feb 24 '19 at 21:47
  • SchemaSpy v. 6.1.0 from [documentation](https://schemaspy.readthedocs.io/en/latest/new.html#id2): "Now has option to use embedded viz.js (no need for Graphviz) `-vizjs`" – a11 Mar 23 '19 at 23:40
4

Working fix on High Sierra for this:

brew uninstall graphviz

After that run:

brew install graphviz --with-librsvg --with-pango

Source:https://github.com/schemaspy/schemaspy/issues/33/#issuecomment-355091538

Shivam Tripathi
  • 415
  • 4
  • 13
  • The `--with...` options seem to be broken with recent versions of hombrew/graphviz: https://github.com/parrt/dtreeviz/issues/33 – David Soroko Aug 18 '21 at 07:31
4

Version 6.1.0 of SchemaSpy has removed the dependency on GraphViz, so you can avoid this problem by using this version.


Version 6.1.0 includes a JavaScript implementation of GraphViz which can be used instead of looking for GraphViz on the PATH.

I'm not sure whether the JavaScript version is used by default, but you can force this behaviour by supplying a -vizjs argument, e.g.

java -jar ./schemaspy-6.1.0-SNAPSHOT.jar -vizjs -t pgsql -o output 
    -host localhost -port 5432 -s public -db my_db -u root -p password 
    -dp jdbc/postgresql-42.2.6.jar

The JavaScript implementation relies on the Nashorn JavaScript engine, which was removed from the JDK in version 15, so you must use JDK <= 14.

Dónal
  • 185,044
  • 174
  • 569
  • 824
1

IF you are on macOs HighSierra the correct call is without the renderer and (re)install Graphviz with:

brew reinstall graphviz --with-librsvg --with-pango

roundcrisis
  • 17,276
  • 14
  • 60
  • 92
1

I tried the above methods, but it wasn't working for me.

Running on mojave, I wasn't able to get the brew installation to work (due to missing pango libraries). Maybe this will be updated in the future, but at the time of this writing, I had to switch to the Macports installation and this worked for me.

Also running schemaspy 6.0.0, and Graphviz 2.40.1.

rcheuk
  • 1,140
  • 1
  • 12
  • 32
1

Installing graphviz with brew now (as of 2021) installs both librsvg and pango by default. No need to pass the --with-* options: they are not valid anymore either, as others have commented.

Just run brew install graphviz and ensure you're using the correct renderer option, per accepted answer and project FAQs.

Mac version: Catalina 10.15.7

Full dependency list:

==> Installing dependencies for graphviz: libpng, freetype, fontconfig, jpeg, libtiff, giflib, webp, gd, gettext, libffi, pcre, gdbm, mpdecimal, ca-certificates, openssl@1.1, readline, sqlite, xz, python@3.9, glib, jasper, netpbm, gts, pkg-config, libpthread-stubs, xorgproto, libxau, libxdmcp, libxcb, libx11, libxext, libxrender, lzo, pixman, cairo, gdk-pixbuf, fribidi, gobject-introspection, graphite2, icu4c, harfbuzz, pango, librsvg, m4 and libtool
Grey Vugrin
  • 455
  • 5
  • 12
0

Update for this question. Homebrew recently made changes to adding of options when installing a package....they don't allow it anymore. :)

https://brew.sh/2019/02/02/homebrew-2.0.0/

The suggestion was to use brew edit graphviz and add the desired arguments there. I'm trying that now.

Shane Funk
  • 133
  • 2
  • 8