Installing Blender

jhathcock
New Contributor III

Good afternoon,

I need to deploy Blender to a couple of computer labs.  Since its a drag and drop application, how do I prep this for deployment without a package?

1 ACCEPTED SOLUTION

devoted_lkrygsm
New Contributor III

For drag and drop dmg apps like this, I always use a script like below. The tricky part is finding a good "latest" URL to use.

I've poked around the Blender site a bit and I'm not finding an easy way to do that, so you may have to update your script periodically as new versions are released, unless you can find a clever path to use.

Blender also has Intel and ARM specific installer packages, so I've included a switching function I use for that as well.

It's a good pattern to use and doesn't usually require a lot of modification. Good luck!

#!/bin/bash
set -e

# Vendor supplied DMG file
VendorDMG="blender.dmg"
VendorMnt="/Volumes/Blender"
VendorApp="Blender.app"
# VendorDownload=""  # "Latest" download link, if universal
VendorDownloadARM="https://www.blender.org/download/release/Blender4.0/blender-4.0.2-macos-arm64.dmg"
VendorDownloadIntel="https://www.blender.org/download/release/Blender4.0/blender-4.0.2-macos-x64.dmg"
TempLog="/tmp/blender.log"

# Evaluate if this is arm or x86 and set install dir appropriately
if [[ $(uname -m) == 'arm64' ]]; then
	# Apple Silicone
	VendorDownload=$VendorDownloadARM
else
	VendorDownload=$VendorDownloadIntel
fi

# Download vendor supplied DMG file into /tmp/
echo "Starting download: ${VendorDownload}" | tee -a $TempLog
curl -4 -sSL "${VendorDownload}" -o "/tmp/${VendorDMG}"  | tee -a $TempLog

# Mount vendor supplied DMG File
echo "Mounting..."  | tee -a $TempLog
hdiutil attach "/tmp/${VendorDMG}" -nobrowse  | tee -a $TempLog

# Copy contents of vendor supplied DMG file to /Applications/
# Preserve all file attributes and ACLs
echo "Copying to Applications..."  | tee -a $TempLog
cp -pR "${VendorMnt}/${VendorApp}" /Applications/  | tee -a $TempLog

# Identify the correct mount point for the vendor supplied DMG file 
echo "Identifying Mountpoint..."  | tee -a $TempLog
MntDev="$(hdiutil info | grep "${VendorMnt}" | awk '{ print $1 }')"  | tee -a $TempLog

# Unmount the vendor supplied DMG file
echo "Dismounting..." | tee -a $TempLog
hdiutil detach $MntDev | tee -a $TempLog

# Remove the downloaded vendor supplied DMG file
echo "Cleaning up..." | tee -a $TempLog
rm -f /tmp/$VendorDMG 
rm $TempLog

echo "Done!"

View solution in original post

7 REPLIES 7

jamf-42
Valued Contributor II

Composer or Simple Package Creator (getting old but works) 

pete_c
Contributor III

I never went back to fix the .ZIP -> .app handling, but for .DMG it still works well enough to create a Universal .PKG.

https://github.com/da4ftso/build/blob/main/Blender_4.0.2-Universal.zsh

jamf-42
Valued Contributor II

dead link?

pete_c
Contributor III

Derp, sorry, that was a private repo - updated to public, please retry.

AJPinto
Honored Contributor II

I would use JAMF Composer to package it. However, JAMF can deploy DMG's and with some scripting you can move the .app from the dmg to /Applications and unmount the DMG.

devoted_lkrygsm
New Contributor III

For drag and drop dmg apps like this, I always use a script like below. The tricky part is finding a good "latest" URL to use.

I've poked around the Blender site a bit and I'm not finding an easy way to do that, so you may have to update your script periodically as new versions are released, unless you can find a clever path to use.

Blender also has Intel and ARM specific installer packages, so I've included a switching function I use for that as well.

It's a good pattern to use and doesn't usually require a lot of modification. Good luck!

#!/bin/bash
set -e

# Vendor supplied DMG file
VendorDMG="blender.dmg"
VendorMnt="/Volumes/Blender"
VendorApp="Blender.app"
# VendorDownload=""  # "Latest" download link, if universal
VendorDownloadARM="https://www.blender.org/download/release/Blender4.0/blender-4.0.2-macos-arm64.dmg"
VendorDownloadIntel="https://www.blender.org/download/release/Blender4.0/blender-4.0.2-macos-x64.dmg"
TempLog="/tmp/blender.log"

# Evaluate if this is arm or x86 and set install dir appropriately
if [[ $(uname -m) == 'arm64' ]]; then
	# Apple Silicone
	VendorDownload=$VendorDownloadARM
else
	VendorDownload=$VendorDownloadIntel
fi

# Download vendor supplied DMG file into /tmp/
echo "Starting download: ${VendorDownload}" | tee -a $TempLog
curl -4 -sSL "${VendorDownload}" -o "/tmp/${VendorDMG}"  | tee -a $TempLog

# Mount vendor supplied DMG File
echo "Mounting..."  | tee -a $TempLog
hdiutil attach "/tmp/${VendorDMG}" -nobrowse  | tee -a $TempLog

# Copy contents of vendor supplied DMG file to /Applications/
# Preserve all file attributes and ACLs
echo "Copying to Applications..."  | tee -a $TempLog
cp -pR "${VendorMnt}/${VendorApp}" /Applications/  | tee -a $TempLog

# Identify the correct mount point for the vendor supplied DMG file 
echo "Identifying Mountpoint..."  | tee -a $TempLog
MntDev="$(hdiutil info | grep "${VendorMnt}" | awk '{ print $1 }')"  | tee -a $TempLog

# Unmount the vendor supplied DMG file
echo "Dismounting..." | tee -a $TempLog
hdiutil detach $MntDev | tee -a $TempLog

# Remove the downloaded vendor supplied DMG file
echo "Cleaning up..." | tee -a $TempLog
rm -f /tmp/$VendorDMG 
rm $TempLog

echo "Done!"

this worked great, thank you!