Change path for Graphviz?

+1 vote
asked May 15, 2018 in Question / help by tim.rohrer (120 points)
First, by way of background. I'm trying to set this up on a Mac after having used it for awhile on Linux. I use MacPorts, but found it would not install (Error: Failed to fetch plantuml). Rather than fuss with that, I downloaded the latest copy of PlantUML and used MacPorts to install Graphviz.

My base for MacPorts is /opt/local/ so the dot path is /opt/local/bin/dot.

Is there a way to change the location where PlantUML is looking for the binary dot?

Tim

1 Answer

+1 vote
answered May 15, 2018 by plantuml (294,960 points)
You could change the environment variable GRAPHVIZ_DOT (see http://plantuml.com/faq-install ) to let it point to your actual dot executable. You have also information about Mac on http://plantuml.com/graphviz-dot

Finally, we've build a new beta http://beta.plantuml.net/plantuml.jar jar that looks for "dot" as /usr/local/bin/dot then /usr/bin/dot then /opt/local/bin/dot. So this beta should work for you out-of-the-box.

Tell us if it helps!
commented May 16, 2018 by tim.rohrer (120 points)
Thanks!

I apologize for not picking up on the environment variable in the FAQ.  

I tested out the beta. And I'm now also looking into why the macports isn't working :-P

Even with the beta2, I had to set the environ variable which worked for running things in the terminal.

However, I'm so far not getting it to work from VS Code. I'll update/add to this comment if I have any luck.


Tim

===============

UPDATE: Let me document what I did to get the real issue resolved, namely, I wanted to use PlantUML inside of VS Code on a Mac OS platform running High Sierra.

Because I didn't see any way to add a command-line switch for MacOS, I focused on how to set the environment variable (GRAPHVIZ_DOT) at the start of VS Code execution. I could have set it from Terminal, and then run VS Code from that Terminal, but I wanted a more permanent solution.

Following a quick Google, I learned we can create a /etc/launchd.conf file and add setenv GRAPHVIZ_DOT /opt/local/bin/dot, then save the file. At that point, we need to get launchctl to see that. This can be done by rebooting the system, or this worked for me as an admin user:

grep -E "^setenv" /etc/launchd.conf | xargs -t -L 1 launchctl

After that, restart VS Code and use alt-D to build the diagram.

Worked for me, but YMMV.
commented May 16, 2018 by plantuml (294,960 points)
Thanks for your detailed explanation, it will probably help other users!
We fixed the last beta http://beta.plantuml.net/plantuml.jar
It should now work with /opt/local/bin/dot without setting GRAPHVIZ_DOT, but obviously you don't care any more :-)
commented May 16, 2018 by tim.rohrer (120 points)
Well, dang. It turned out my "mileage" wasn't very good. The changes I made did not stick.

But, I downloaded the latest beta and can *confirm* the worked for me on the command line.

Also, the version of PlantUML used in the VS Code extension is internal (which may explain why my change didn't stick), and so the correct way of getting the environmental variable set for that setup is documented here: https://github.com/qjebbs/vscode-plantuml/issues/121
...