Sketch 3 removed from Mac App Store

lucascantor
New Contributor

Per Bohemian Coding's Sketch Blog, Sketch will no longer be distributed via the Mac App Store.

b5a0f3f04de849dd9be490f64f92bccc

We were previously using VPP to distribute Sketch via the Mac App Store, and now that I've tried creating a policy to deploy it as a .pkg via Self Service, I'm running into the issue described by njwinter in a discussion I've previously replied to.

The Sketch App is installed in the user's Applications folder, but it simply won't open.

1 ACCEPTED SOLUTION

bpavlov
Honored Contributor

It wasn't always like this. This change started with 3.4.

I use Packages but you can do this with any other packaging tool. Create a new raw package project in Packages. Fill out the Project and Settings tab accordingly. Under the Scripts tab, add the "sketch.zip" file into Additional Resources. Then create a postinstall script that contains the following:

#!/bin/bash

#Working directory for script to reference resources
install_dir=`dirname $0`

SketchZip="sketch 3.4.3.zip" #Name of sketch zip file should go here
SketchApp="Sketch.app"

#Remove Sketch
if [ -d $3/Applications/"$SketchApp" ]; then
    /bin/rm -rf $3/Applications/"$SketchApp"
fi

#Unzip application to /Applications folder
/usr/bin/ditto -V -x -k --sequesterRsrc --rsrc $install_dir/"$SketchZip" $3/Applications

/usr/sbin/chown -R root:wheel $3/Applications/"$SketchApp"

To make sure the postinstall script will run make sure to do the following in Terminal:
sudo chmod a+x /path/to/postinstallscript

Then build your package. That's the gist of it.

View solution in original post

10 REPLIES 10

bpavlov
Honored Contributor

It wasn't always like this. This change started with 3.4.

I use Packages but you can do this with any other packaging tool. Create a new raw package project in Packages. Fill out the Project and Settings tab accordingly. Under the Scripts tab, add the "sketch.zip" file into Additional Resources. Then create a postinstall script that contains the following:

#!/bin/bash

#Working directory for script to reference resources
install_dir=`dirname $0`

SketchZip="sketch 3.4.3.zip" #Name of sketch zip file should go here
SketchApp="Sketch.app"

#Remove Sketch
if [ -d $3/Applications/"$SketchApp" ]; then
    /bin/rm -rf $3/Applications/"$SketchApp"
fi

#Unzip application to /Applications folder
/usr/bin/ditto -V -x -k --sequesterRsrc --rsrc $install_dir/"$SketchZip" $3/Applications

/usr/sbin/chown -R root:wheel $3/Applications/"$SketchApp"

To make sure the postinstall script will run make sure to do the following in Terminal:
sudo chmod a+x /path/to/postinstallscript

Then build your package. That's the gist of it.

poweruser86
New Contributor

Have any of you found a way to disable the pop up prompt for an email address? We migrated our VPP tokens to a single serial number, but on first launch users are still presented with this dialog box and the only way to dismiss it is by entering an email address.

After a user enters their (or ANY, I have one person with asdf@asdf.com) email address, the app will license itself based on the .deployment file containing the key. Then, a separate 1 seat key will be mailed from Bohemian Coding automatically.

I've been sending these extra keys to Bohemian to invalidate, but I'd prefer not to have to bother my users with it or suck up their support time.

greatkemo
Contributor II

Hi Guys,

If anyone needs help with Sketch, here is something I wrote to download the latest copy, serialize it and set preferences. Just replace this with you key LicenseKey="SK3-XXX-XXXX-XXXX-XXXX-XXXX" in the script.

Hope it helps someone

#!/bin/bash

function ConfigureSkecth () {

    echo "`date` Adding preferences for all users"
    defaults write /Library/Preferences/com.bohemiancoding.sketch3.plist SUEnableAutomaticChecks -bool NO
    defaults write /Library/Preferences/com.bohemiancoding.sketch3.plist SUAutomaticallyUpdate -bool NO
    defaults write /Library/Preferences/com.bohemiancoding.sketch3.plist SUHasLaunchedBefore -bool YES
    defaults write /Library/Preferences/com.bohemiancoding.sketch3.plist hasShown23Welcome -bool YES
    echo "`date` All preferences are now added"
    echo "`date` Installation is now complete"
    echo "`date` ========== Installation Ended =========="

}


function SerializeSketch () {

    # add serial number for current and all future users
    CurrentUsers=`sudo -u $(ls -l /dev/console | awk {'print $3'}) ls /Users/  | tr '
' ' '`
    LicenseKey="SK3-XXX-XXXX-XXXX-XXXX-XXXX"
    echo "`date` Adding license key for current users"
    if [[ -e /Library/Application Support/com.bohemiancoding.sketch3 ]]; then
        rm -rf /Library/Application Support/com.bohemiancoding.sketch3
        mkdir -p /Library/Application Support/com.bohemiancoding.sketch3
        touch /Library/Application Support/com.bohemiancoding.sketch3/.deployment
        echo "$LicenseKey" > /Library/Application Support/com.bohemiancoding.sketch3/.deployment
    else    
        mkdir -p /Library/Application Support/com.bohemiancoding.sketch3
        touch /Library/Application Support/com.bohemiancoding.sketch3/.deployment
        echo "$LicenseKey" > /Library/Application Support/com.bohemiancoding.sketch3/.deployment
    fi
    echo "`date` All license keys are now added"
    echo "`date` Starting Configuration"
    ConfigureSkecth

}


function InstallSketch () {

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

}


function RemoveSketch () {

    # Remove and all related files if sketch if installed
    echo "`date` Removing Sketch.app"
    if [[ -d '/Applications/Sketch.app' ]]; then
        until [[ ! -d '/Applications/Sketch.app' ]]; do
            rm -rf /Applications/Sketch.app
        done
        echo "`date` Sketch.app was removed"
        echo "`date` Removing related files"
        for dir in Users private System; do
            find /$dir -name "*bohemiancoding*" -exec rm -rf {} ; >/dev/null 2>&1
        done
        echo "`date` All related files were removed"
        echo "`date` Begining installation of sketch3"
        InstallSketch
    fi

}

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
    fi
    echo "`date` ========== Installation Started =========="
    echo "`date` Detecting if Sketch is installed or not"
    if [[ -d '/Applications/Sketch.app' ]]; then
        echo "`date` Sketch was detected, will remove"
        RemoveSketch
    else
        echo "`date` Sketch was not detected, will install"
        InstallSketch
    fi

}

function LogSketch () {

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

}

LogSketch
DetectSketch

exit 0

chuck3000
Contributor

@greatkemo Heya. I found a couple of things...
One, I have multiple serial numbers that are used depending on what department purchased the licenses, so rather than saving them globally I've modified the script to save the plists to each user's home directory.

However, In my attempt to simply re-run the script by changing out the License code line, I find that since the script thinks the software is already installed, it doesn't update the .license file, or it removes it and doesn't re-write it.

Additionally, since I have multi-user licenses and the default is for the software to generate a license key based on the machine that installs the key, for me it's easier to use Composer and grab the .license file and using vi, modify the entry with machine name to something that's generically relevant to the license purchased for that department. Then I package that license file and deploy it instead of re-running the script.

I know I'm in a situation that's probably not too normal but it is something I have to deal with.

If you've modified the script at all, can you post it's update?

Thanks for positing originally! It's been a great help!

phredman
New Contributor III

Just FYI - if you reach out to Bohemian Coding - their support can help you combine your license keys into one, and then you can purchase "extensions" for your key moving forward. I just completed doing that this week, granted we only had 15 or so, but it's much simpler for deployment.

McGinn
Contributor

Thanks a lot @greatkemo that script does exactly what I want

quedayone
Contributor

@greatkemo Works great! Thank you.

Wi11

greatkemo
Contributor II

@quedayone Gad it helped. And just an FYI to anyone interested in Sketch or using Sketch in academic institutes. It is not FREE from EDU. Check out the link Sketch EDU Store.

vanschip-gerard
Contributor

Thanks for that great script @greatkemo . It worked flawless but one small issue I noticed. When I unlink the license it will relink itself, endlessly. Any suggestions on how I can fix that?

Asking as we have regular Interns and it would make my life so much easier if they can simply Self Service Sketch and then at the end f their internship unlink to return the seat to the pool.

greatkemo
Contributor II

@vanschip-gerard unfortunately not, unless they have an API for the licensing site which you can interact with, otherwise you would need to unlink licenses from their site manually. Best to ask Sketch support about your options for this scenario. In our case, as we are an educational institute, and sketch is free for EDU, I ordered a lot more licenses than we can every use, and don't have to worry about unlinking the licenses.