Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open dot on Mac [closed]

Tags:

macos

graphviz

First of all, I am new to MacOS, and what I want is to be able to see the output of llc -view-dag-combine1-dags sum.ll. On Mac, llc will generate dot in /tmp directory, and try open App to show the dot file. I have tried Graphviz, but it doesn't work (the program crash). I would like try something else, like xdot for example. I install it by brew install xdot, but don't know how to let the MacOS use the xdot I just installed to open the dot file.

Or any other better tool to view the dot file? I would like to keep thing as simple as possible.

like image 268
chenwj Avatar asked Apr 12 '17 14:04

chenwj


People also ask

How do I view a .dot file?

How to open a DOT file. You can open DOT files with Microsoft Word in Windows and macOS. The word processor is also available for Android and iOS devices, but only the iOS version supports DOT files. Other word processors can also open DOT files but they may not fully support the formatting of the original templates.

What is DOT button on Mac?

The old explanation that the dot in the close button means the document is "dirty" and not saved or interruptible isn't called out in the Human Interface Guidelines. Now that versions and Auto Save are being pushed, this dot will mean there is a problem saving (disk full) more than just an unsaved change.

How do I open a .dot file in Graphviz?

You might have to set the paths to the Graphviz binaries in Zgrviewer's preferences. File -> Open -> Open with dot -> SVG pipeline (standard) ... Pick your . dot file.


Video Answer


3 Answers

I never used 'llc' before.

But in my case to deal with the .dot file

I used brew install graphviz

Then used the following command to convert .dot to .png

dot -Tpng DocName.dot -o DocName.png

It works every time without crash.

like image 77
Leowang Avatar answered Oct 19 '22 03:10

Leowang


You can also build the Graphviz GUI app using homebrew if you have Xcode installed:

brew install graphviz --with-app

If you already installed the graphviz brew, you will want to do this:

brew reinstall graphviz --with-app

At the time of writing, this doesn't appear to install a symlink to the app into /Applications like cask does, so if you want that you'll need to do it manually (or copy the application out).

To find the location of the app bundle, have a look at the build log, you should see a line like this:

./configure --prefix=/usr/local/Cellar/graphviz/2.40.1

If you don't have the build log anymore, you can determine this path by running brew list graphviz or brew info graphviz.

Open up the folder (replace this with the actual path you determined in the previous step):

open /usr/local/Cellar/graphviz/2.40.1

Inside here you should see Graphviz.app. You can move/copy it to /Applications or create an alias by dragging it to /Applications and holding the and option keys.

Warning! May currently be broken on Mojave.

Please see comment below from Kim Stacks:

As of 2018-12-21, for macOS mojave, there's an issue with using the --with-app flag in the brew install command. See gitlab.com/graphviz/graphviz/issues/1445. Will update this when the fix is working.

It appears as if there is an issue with Graphviz itself currently preventing builds on macOS Mojave. Please do not comment on this answer saying that it doesn't work, it will accomplish nothing. You may follow the issue above for more updates and we'll try to update this answer if/when the situation is resolved by the Graphviz devs.

If people want to help get this fixed, there is a partially implemented upgrade PR that needs some love to take it over the finish line (see comments.)~~

Update: build is fixed, but homebrew has removed GUI support

The saga continues. The upstream build breakage with Graphviz was resolved in August 2020. However, the homebrew team has apparently instituted a new policy to remove all build options from Homebrew formulae. The --with-app option was removed from graphviz formula in January 2019.

I'm afraid I don't have a new solution for how to do this other than manually building from source. If somebody has any ideas, please share them in the comments. I am going to keep this answer up as I think this should be the right way to do this, we just need more advocacy (and volunteer devs) to improve the user experience for Graphviz users on macOS.

like image 45
Eliot Avatar answered Oct 19 '22 03:10

Eliot


Homebrew has graphviz which is command line only. I would suggest using MacPorts to install graphviz-gui, that will save us from a lot of trouble.

like image 44
chenwj Avatar answered Oct 19 '22 01:10

chenwj