Sketch Application - So many updates so quickly

New Contributor III

So we don't give users admin for obvious reasons and Sketch comes out with updates almost weekly at this point.

The problem is their files are only compatible with the version they were made in.
I haven't worked autopkg into my workflow yet (I know!) so I wrote this today
Self service update script is as follows


Update Sketch Application - Created by Justin Repasky 03-03-2016 ####

Remove any older versions of sketch-updates folder and re-create

if test -d "/Applications/Utilities/IT/sketch-updates/" then rm -Rf "/Applications/Utilities/IT/sketch-updates/" | mkdir -p "/Applications/Utilities/IT/sketch-updates/" ;
else mkdir -p "/Applications/Utilities/IT/sketch-updates/"

cd "/Applications/Utilities/IT/sketch-updates/"
sudo curl -O /Applications/Utilities/IT/sketch-updates/; sudo unzip;

if test -d "/Applications/" then sudo rm -R "/Applications/" ;

sudo mv "/Applications/Utilities/IT/sketch-updates/" "/Applications/"


New Contributor II

Thanks for this!

We don't give our users admin are you currently licensing the app in deployment? As far as I can tell there's a unique .license file tied to the registered computer.

We have a multi license serial but can't seem to apply it except manually typing it in. Any insights?

New Contributor
how are you currently licensing the app in deployment? As far as I can tell there's a unique .license file tied to the registered computer.

Came here for same question. Any insights @jrepasky ? Or have you had any luck @kpowerbook

New Contributor II

I reached out to Sketch's support team for answer.

You just need to create a text file (make sure to use plain text) containing the serial key and save it as ".deployment" in one of the following directories: /Library/Application Support/com.bohemiancoding.sketch3/.deployment - for all users ~/Library/Application Support/com.bohemiancoding.sketch3/.deployment - for a specific user

New Contributor

Awesome! Thanks @kpowerbook !

New Contributor

@kpowerbook Have you been able to get this to work?

I've tried dropping the .deployment file in both locations but it doesn't seem to do anything...
Were there any other criteria?

Contributor III

@travis.gingrich You're probably running into the same issue we did: Sketch checks for a manually installed license before it checks for the .deployment one. If a user has installed/launched Sketch prior to installing your copy with the .deployment serial, it ignores this file. What you need to do is remove:

/Users/$username/Library/Application Support/com.bohemiancoding.sketch3/.license

Then at next launch Sketch will see your .deployment file.

New Contributor

what i did was to use self service to launch sketch as root and guide user to perform the update and install. after downloading and installation the software will close off and relaunch as user with updated version. license and every still intact.

understand this not the best way but you may wish to add a script with time to kill off the task if it takes too long incase user initial any other stuff using the root launch sketch.

New Contributor

Modified the script slightly just to make it easier to read and only use for updating rather than deployment, but I'm having some issues

if [ -d "/tmp/IT/sketch-updates/" ]
    sudo rm -Rf "/tmp/IT/sketch-updates/" | sudo mkdir -p "/tmp/IT/sketch-updates/"
    sudo mkdir -p "/tmp/IT/sketch-updates/"

cd "/tmp/IT/sketch-updates/"
sudo curl -L -O ""
sudo unzip "/tmp/IT/sketch-updates/"

sudo rm -R "/Applications/"

sudo mv "/tmp/IT/sketch-updates/" "/Applications/"

If I run the commands locally, everything seems to work as it should... but if I run through Self-Service, it errors out. Result from log:

[STEP 1 of 4]
Executing Policy Sketch
[STEP 2 of 4]
Running script Update Sketch...
Script exit code: 1
Script result: /Library/Application Support/JAMF/tmp/Update Sketch: line 12: cd: /tmp/IT/sketch-updates/: No such file or directory
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed

0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0

18 21.2M 18 3935k 0 0 3585k 0 0:00:06 0:00:01 0:00:05 3585k
100 21.2M 100 21.2M 0 0 10.4M 0 0:00:02 0:00:02 --:--:-- 18.4M
unzip: cannot find or open /tmp/IT/sketch-updates/, /tmp/IT/sketch-updates/ or /tmp/IT/sketch-updates/
mv: rename /tmp/IT/sketch-updates/ to /Applications/ No such file or directory
Error running script: return code was 1.
[STEP 3 of 4]
[STEP 4 of 4]

Seems like things are running out of order or it's skipping some commands, but I can't tell why. Any guidance on how to help troubleshoot when if I run the commands in a terminal everything seems to run as it should?

New Contributor

Hi mrory i'm using this script to update sketch via the self service. Works perfect.


function InstallSketch () {

    # download and install the latest version
    until [[ -d '/Applications/' ]]; do
        if [[ -e /tmp/ ]]; then
            rm -rf /tmp/
        if [[ -d /tmp/__MACOSX ]]; then
            rm -rf /tmp/__MACOSX/
        if [[ -d /tmp/ ]]; then
            rm -rf /tmp/
        echo "`date` Downloading Sketch"
        curl -L -o /tmp/ "" >/dev/null 2>&1
        echo "`date` Download complete"
        cd /tmp/
        echo "`date` Unzipping archive"
        unzip  >/dev/null 2>&1
        echo "`date` Archive unizpped"
        echo "`date` Moving to the Applications directory"
        mv /Applications
        echo "`date` Editing permissions"
        chown -R root:wheel /Applications/
        chmod -R 755 /Applications/
        cd ~
        echo "`date` Removing temporary files"
        rm -rf /tmp/ && rm -rf /tmp/__MACOSX && rm -rf /tmp/


function RemoveSketch () {

    # Remove and all related files if sketch if installed
    echo "`date` Removing"
    if [[ -d '/Applications/' ]]; then
        until [[ ! -d '/Applications/' ]]; do
            rm -rf /Applications/
        echo "`date` was removed"
        echo "`date` Begining installation of sketch3"


function DetectSketch () {

    # Check to see whether Sketch is installed or not, if yes, remove it, then install latest, if no, then install latest.
    pgrep Sketch >/dev/null
    if [[ $? = 0 ]]; then
        pkill Sketch
    echo "`date` ========== Installation Started =========="
    echo "`date` Detecting if Sketch is installed or not"
    if [[ -d '/Applications/' ]]; then
        echo "`date` Sketch was detected, will remove"
        echo "`date` Sketch was not detected, will install"


function LogSketch () {

    # Setup log files if logs do not exists, create it, otherwise start logging
    if [[ ! -e $LogFile ]]; then
        touch $LogFile && exec >> $LogFile
        echo "`date` ========== Log File Created =========="
        exec >> $LogFile



exit 0

Contributor II

@dwils Could have at least cited where you got the script from.

New Contributor III

Thanks @kpowerbook & @cdev! It works perfectly!

New Contributor II

@dwils Thanks! that worked perfectly

New Contributor II

This still works great, thanks jrepasky and dwils

New Contributor

This works great @dwils

New Contributor
curl -L -o ""

Anyone else seeing issues with this zip file post download?

New Contributor III


This script just broke down and it looks like the download link:

The download link is unreachable at the moment.


Anyone else having these issues? If so, any solutions found?

see my post below 

New Contributor II

the URL changed. It is now this: