Plugins

Write a Sketch plugin in JavaScript. Take advantage of ES6, access macOS frameworks and use the Sketch APIs without learning Objective-C or Swift.

APIs

Plugins can make use of the following APIs:

Plugin location

Plugins are stored as folders within the user’s home folder. Sketch scans this plugin location on launch for installed plugins.

~/Library/Application Support/com.bohemiancoding.sketch3/Plugins

When a plugin was updated, previously installed versions are kept in a separate folder.

~/Library/Application Support/com.bohemiancoding.sketch3/PluginsWarehouse

Quick tip: You can access the plugins folder by holding alt while opening the Plugins menu in Sketch and then choose ‘Reveal Plugins Folder’.

Installing Plugins

If you double-click a .sketchplugin file, Sketch will copy it into the Plugins folder for you. Any commands that it implements should immediately show up in the Plugins menu.

Alternatively, you can install plugins by simply moving them into the Plugins folder yourself.

Note: Sketch also supports using aliases and links to individual Plugins, or to the Plugins folder itself. This allows you to place them elsewhere (for example, a Dropbox folder to keep multiple installs of Sketch synced).

Uninstalling Plugins

To remove a Plugin, just select the Plugins › Manage Plugins… menu option, select the Plugin you want to remove from the list, and either right click the plugin or click the gear icon and select Uninstall “Plugin Name”:

Uninstall a plugin in Sketch Preferences using the context menu

Any commands that the Plugin provided will be removed from the Plugins menu immediately.

Alternatively, you can just uncheck any Plugin on the list to disable it without uninstalling it.

Examples

Explore some sample plugins built by Sketch.

Find plugins

Resources

JavaScript

Books

Cocoa

  • AppKit, one the main Apple frameworks that Sketch is built on.
  • Foundation, more essential Apple classes and services.

CocoaScript

Tools

  • SketchTool - An OS X command-line app for exporting Pages and Slices out of .sketch documents.
  • Sketch Scripter, by Timur Carpeev. an Atom package for running Sketch scripts from the Atom editor.
  • class-dump. We do our best to document everything, but if you are of the adventurous type, you’ll probably want to play with this.
  • Sketch Plugin Manager - A utility to create, build and publish sketch plugins.