Generate UML diagrams under OSX

If you work in IT, you probably want to generate UML diagrams.

There are a lot of way to do that, but some may require proprietary softwares.

I had a look to some of them, and chose to explain the easiest ways I found using Open Source librairies (if you're a minimum techie)

The recommended tools are:

They won't fit the same usage / needs, so you should have an idea of what you need :-)

Scruffy

I discovered yUML.me mid-2014 when I started to work with Neo4j.

It's an amazing online tool, really easy to use for simple graphs.

Scruffy is the library used behind yUML.me, and is available for download/fork on Github.

But Scruffy:

  • is was hard to install because of dependencies
  • won't fit for complex graphs

I sent a Pull Request to explain of to install Scruffy under Mac OSX and here the detailed version:

  • install Homebrew
  • install graphviz and plotutils

    brew install graphviz plotutils

    brew install imagemagick --with-librsvg

  • if you haven't pip yet

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py sudo python get-pip.py

  • install scuffy and image (PIL replacement)

    sudo pip install image scruffy

You can now use Scruffy, here's a basic example:

suml --png --font-family Purisa --scruffy "[Node A]->[Node B],[Node B]->[Node C],[Group [Node A][Node B]]" > test.png

Will generate:

PlantUML

Their website is really oldschool... yes. But this tool allows you to generate complex and real <uml> diagrams.

I personally use SublimeText as text editor / IDE, and Jayson Vantuyl created a plugin to generate you diagrams directly from this IDE.

The install guide available on Github is clear if you use SublimeText. Sorry, but I won't cover other IDE here, but PlantUML provides useful links.

Here is an activity diagram example:

@startuml
(*) --> if "Some Test" then
  -->[true] "activity 1"
  if "" then
    -> "activity 3" as a3
  else
    if "Other test" then
      -left-> "activity 5"
    else
      --> "activity 6"
    endif
  endif
else
  ->[false] "activity 2"      
endif
a3 --> if "last test" then
  --> "activity 7"
else
  -> "activity 8"
endif
@enduml

(Looks like basic code, isn't it?)

Will generate:

There are many kinds of diagrams that can be generated with PlanUML.