I've used Satimage's Smile app to make vector diagrams (for technical illustrations, laser-cutting patterns, etc) via AppleScript augmented with drawing commands. It's like the opposite of PaintCode, which turns drawings into code. (I'm a mathematician, not an artist, so I want/need to describe images with formulas and equations.)

Sadly, macOS Mojave broke OSAX functionality, making Smile completely unusable.[*] Besides, the oh-so-rudimentary Smile UI can be pretty frustrating. It's time to seek an alternative.

The "code" doesn't have to be AppleScript. I've seen a couple of open-source (usually Qt) apps for editing TikZ, a programmatic graphics language. However, these are geared towards tweaking TikZ code for import into a LaTeX documents and whatnot; I'm looking for something more of a stand-alone document editor, capable of exporting to PDF or EPS directly. (But if there's a really good Mac-like TikZ editor, I'd consider it.)

[*] There's apparently an AppleScript workaround using an an auxiliary SatimageOSAX app, but I haven't gotten it to work with Smile. Besides, it's only a patch, doomed to break eventually.

  • I recommend to take a look at Python and Matplotlib (matpltotlib.org) - both are by default installed in Mojave and are very easy to use it - as a mathematician you can do it fast - you can use it for 2D/3D graphics, the supported pictures are PNG/EPS/JPG/SVG, etc. One note about .eps format - has a security bug and Apple convert instantly such pictures in .pdf when opened in Preview.
    – Yoan
    Nov 28, 2018 at 7:47
  • @Yoan: I'll have a look. (I've not used Python before, but I've seen the obligatory XKCD, so I'm suitably intrigued.) That said, while I'm not completely averse to command-line shenanigans to install stuff, I use a GUI-based computer for a reason. :) The Matplotlib page mentions three third-party distributions that "just work": Anaconda, Canopy, and ActiveState. Any thoughts on these?
    – Blue
    Nov 28, 2018 at 9:13
  • 1
    Yes, Anaconda, for sure. Has several applications, Spider is an IDE with text editor and ipython debugger, all you need to do it in a GUI. Python version in Mohave is 2.7.10, but Anaconda has the latest, 3.7.0. Recommend to install it in your $HOME path, is very useful as such, especially if you use Emacs (supports Latex, Python, org-mode, etc). Python 2.7 is used by Apple to maintain/install software on your computer, so it is wise not to interfere with it, at least at the beginning.
    – Yoan
    Nov 28, 2018 at 11:37

3 Answers 3



An open source and complete picture drawing language, with plenty of support and documentation, is MetaPost.

The MetaPost system (by John Hobby) implements a picture-drawing language very much like that of MetaFont; the difference is that MetaPost outputs vector graphic files instead of run-length-encoded bitmaps; output formats available are PostScript and SVG.

MetaPost is capable of creating complex images and shapes:

Example image created with MetaPost

    pair A, B, C;
    A:=(0,0); B:=(1cm,0); C:=(0,1cm);
    draw A--B;
    draw B--C dashed evenly;
    draw C--A dashed withdots;


Complex image drawn with MetaPost

  pair A, B, C, D, E;
  path p, q, r;

  A = u*up;
  p := (-.2)[ A, A rotated 72 ] -- (1.2)[ A, A rotated 72 ];
  for i=0 upto 5:
    draw p rotated 72i;
  B := 1/2[ A, A rotated 72 ];
  C := .8*B;

  p := B --- C .. (C rotated (2*72)){right};
  % On allonge le chemin p
  p := ( (point 0 of p) - 4mm*unitvector(direction 0 of p))
       (point 0 of p)
       & p &
       (point 2 of p)
       ( (point 2 of p) + 4mm*unitvector(direction 2 of p));

  E = p intersectionpoint (p rotated 72);
  q := p cutbefore fullcircle scaled -2mm shifted E;
  r := p cutafter fullcircle scaled  2mm shifted E;

  for i=0 upto 4:
    draw q rotated 72i;
    draw r rotated 72i;
    draw A rotated 72i withpen pencircle scaled 4bp;
    draw B rotated 72i withpen pencircle scaled 4bp;
    draw C rotated 72i withpen pencircle scaled 4bp;

You can install MetaPost as part of BasicTex.


Aimed more at designers than engineers, Sketch offers a programmable interface and AppleScript support.

Side Note

As an aside, Apple once distributed a sample vector drawing application also called Sketch. One purpose of Sketch was to demonstrate how to incorporate AppleScript into an application.

  • 1
    Fascinating. MetaPost has been right there in "typesetting program" popup of TeXShop all these years! The prospect of acclimating to yet-another custom scripting paradigm is a bit off-putting, but MP seems nicely suited to the kinds of figures I tend to make (lots of symmetry). I'll experiment for a while. In the meantime, I'll leave the question open to see if there are even more alternatives.
    – Blue
    Nov 29, 2018 at 3:08
  • By the way: Do you know if there's a way to get TeXShop to show the rendered MP image automatically? Dropping back into the Finder to open the generated .ps file is already tedious .. .and I've only had to do it twice! :) (Hmmmm ... I wonder if I can setup a "watched folder" folder action to open newly-detected .ps files in Preview.)
    – Blue
    Nov 29, 2018 at 3:08
  • I expect a watched folder approach would work. Maybe worth asking a new question to attract more answers. If you can share your initial attempt at a watch folder workflow or script, you will likely attract others happy to help refine it or fix any problems. Nov 29, 2018 at 7:48
  • At least learning this scripting paradigm will give you something that could outlast macOS and be portable to other platforms! I hope MetaPost works for you. Nov 29, 2018 at 7:50
  • 1
    Alas, I don't believe MetaPost is a viable solution, after all. Reading the manual(!?!), I find that "Because of the mathematical model that is used to describe paths in MetaPost, all these are not exactly circular paths, but very good approximations". (Indeed, in the generated PostScript, I see that "circles" comprise various Bezier curvetos instead of arcs.) Approximations would be fine for my illustrations, but I need "real" circles for my laser-cutting projects, which are my primary concern.
    – Blue
    Dec 29, 2018 at 13:50

Open Source - Computer Aided Design

Another possibility for your laser-cutting projects is a full Computer Aided Design (CAD) application. There are a few open source (free and community maintained) choices, as well as plenty of commercial options.

  1. LibreCAD

    LibreCAD is a free Open Source CAD application for Windows, Apple and Linux. Support and documentation is free from our large, dedicated community of users, contributors and developers.

  2. QCAD - 2D CAD

    QCAD is a free, open source application for computer aided drafting (CAD) in two dimensions (2D). With QCAD you can create technical drawings such as plans for buildings, interiors, mechanical parts or schematics and diagrams.

  3. FreeCAD

    FreeCAD is an open-source parametric 3D modeler made primarily to design real-life objects of any size. Parametric modeling allows you to easily modify your design by going back into your model history and changing its parameters.

  • Thanks. After cursory review: LibreCAD allows "command line" drawing, but not scripted drawing (loops/conditionals/etc), per se. QCAD does scripts, but they need to be typed-up elsewhere and pasted in; no real integration. FreeCAD says it's Python-scriptable, and it has a nifty Python console showing how things are done; however, from what I can tell, scripting is accomplished via a klunky macro interface. (.svg export indicates that circles are circles, though!) As an app-maker, I may just opt for Xcode; the workflow will be weird, but I'll have power and flexibility.
    – Blue
    Dec 29, 2018 at 17:10

Don't forget that PostScript itself is a programming language, with clear commands for creating vector objects.

There are many resources for programming in PostScript, not least on Adobe's website.

  • +1. There is that ... Postscript isn't the "prettiest" language, even at modest levels of complexity, but my diagrams are fairly complex. :) I wouldn't want to type that stuff up in TextEdit! A dedicated postscript editing environment, with syntax coloring and autocompletion and all the bells and whistles, might make this a viable option, but I don't believe such an environment exists.
    – Blue
    Dec 29, 2018 at 17:34
  • I've created a syntax coloring module for BBEdit, but no auto-complete! Another option might be to use a Scripting Bridge to access MacOS's CoreGraphics APIs, through languages like Python (Ruby?) or AppleScript. Once you understand the framework, creating functions to perform Bezier curves, polygons, and transformations is pretty straightforward.
    – benwiggy
    Dec 29, 2018 at 22:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .