Skip to content

Instantly share code, notes, and snippets.

@dannguyen
Last active March 5, 2025 23:27
Show Gist options
  • Save dannguyen/f056d05bb7fec408bb7c14ea1552c349 to your computer and use it in GitHub Desktop.
Save dannguyen/f056d05bb7fec408bb7c14ea1552c349 to your computer and use it in GitHub Desktop.
How to use schemacrawler to generate schema diagrams for SQLite from the commandline (Mac OS)
#!/usr/bin/env bash
# A shell script customized for modern MacOS, which assumes /usr/local/bin and /usr/local/opt exist
# https://gist.github.com/dannguyen/f056d05bb7fec408bb7c14ea1552c349/edit
SC_DIR=/usr/local/opt/schemacrawler
java -cp $(echo $SC_DIR/lib/*.jar | tr ' ' ':'):$SC_DIR/config \
schemacrawler.Main "$@"

Generating cool SQLite database diagramswith schemacrawler on Mac OS

This was tested on MacOS 10.13

schemacrawler is a free and open-source database schema discovery and comprehension tool.

Install graphviz dependency

For schema drawing, schemacrawler uses graphviz, which can be installed via homebrew:

brew install graphviz

Install schemacrawler

The latest releases can be found on the Github page:

https://github.com/schemacrawler/SchemaCrawler/releases/

curl -Lo /tmp/schemacrawler-14.21.02-distribution.zip \
   https://github.com/schemacrawler/SchemaCrawler/releases/download/v14.21.02/schemacrawler-14.21.02-distribution.zip 

mkdir -p /usr/local/opt/schemacrawler

unzip /tmp/schemacrawler-14.21.02-distribution.zip -d /usr/local/opt/schemacrawler

ln -s /usr/local/opt/schemacrawler/schemacrawler-14.21.02-distribution/_schemacrawler/schemacrawler.sh /usr/local/bin/schemacrawler









@jonofoz
Copy link

jonofoz commented Mar 15, 2019

You'd never know this would help someone random like me, but it was the only thing that helped a random person like me, so thank you. <3

@igustafson
Copy link

This was very helpful to this rando as well

@Samox
Copy link

Samox commented Jun 13, 2019

<3

@PavelPolyakov
Copy link

PavelPolyakov commented Jul 17, 2019

Nice guide, thank you!

(part of the comment is removed, since is not actual anymore)

@dannguyen
Copy link
Author

@PavelPolyakov thanks! Looks like I also needed to run unzip with the -d ${TEMPDIR} flag so that it wouldn't install to wherever you were running the commands. Created an updated version of the script to reflect this.

@PavelPolyakov
Copy link

@dannguyen cool, I suggest we remove the old ones to not confuse people

@jdraths
Copy link

jdraths commented Aug 18, 2020

👍 I forgot to chmod 744 the script file at first and was banging my head for a minute.

@benabbes-slimane-takiedine

is there a way to use this on windows 10 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment