Posted on 12-01-2015 04:32 PM
Per Bohemian Coding's Sketch Blog, Sketch will no longer be distributed via the Mac App Store.
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.
Solved! Go to Solution.
Posted on 12-02-2015 06:32 AM
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.
Posted on 12-02-2015 06:32 AM
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.
Posted on 12-10-2015 11:09 AM
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.
Posted on 05-18-2016 12:25 PM
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
Posted on 06-28-2016 02:42 PM
@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!
Posted on 09-01-2016 06:16 AM
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.
Posted on 12-14-2016 09:32 AM
Thanks a lot @greatkemo that script does exactly what I want
Posted on 03-16-2017 07:45 AM
@greatkemo Works great! Thank you.
Wi11
Posted on 04-30-2017 01:38 AM
@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.
Posted on 02-03-2019 10:27 PM
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.
Posted on 02-03-2019 10:37 PM
@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.