I was wondering if there's an updated script on installing vlc on macOS Catalina machines. I have tried modifying older scripts with no luck. Any help would be appreciated. Thank you.
- Home
- Community
- Get Support
- General Discussions
- Installing VLC macOS 10.15
19 replies
- Contributor
- February 11, 2020
I just had it fail from the videolan.org website (2x, worked on the 3rd time). If you use one of the mirrors, the old any-app-template method should still work.
- Contributor
- February 11, 2020
Hey just tested this one and it seemed to work just fine:
#!/bin/bash
temp=$TMPDIR$(uuidgen)
mkdir -p $temp/mount
curl https://vlc.freemirror.org/vlc/3.0.7.1/macosx/vlc-3.0.7.1.dmg > $temp/1.dmg
yes | hdiutil attach -noverify -nobrowse -mountpoint $temp/mount $temp/1.dmg
cp -r $temp/mount/*.app /Applications
hdiutil detach $temp/mount
rm -r $temp- Contributor
- February 11, 2020
#!/bin/sh
temp=$TMPDIR$(uuidgen)
mkdir -p $temp/mount
vlcVersion=`expr "$(curl "get.videolan.org/vlc/last/macosx/")" : '.*(vlc-.*.dmg)'`
curl -L get.videolan.org/vlc/last/macosx/$vlcVersion > $temp/vlc.dmg
yes | hdiutil attach -noverify -nobrowse -mountpoint $temp/mount $temp/vlc.dmg
cp -r $temp/mount/*.app /Applications
hdiutil detach $temp/mount
rm -r $temp
This is my current solution and its been working great!
- Author
- New Contributor
- February 12, 2020
Hi,
I tried both scripts and I keep getting this error message on the logs:
Script result: mkdir: D9C3A8D4-7870-4193-B2D8-9003F4986610/mount: Read-only file system
/Library/Application Support/JAMF/tmp/newvlc: line 4: D9C3A8D4-7870-4193-B2D8-9003F4986610/1.dmg: No such file or directory
hdiutil: attach failed - No such file or directory
cp: D9C3A8D4-7870-4193-B2D8-9003F4986610/mount/*.app: No such file or directory
hdiutil: detach failed - No such file or directory
rm: D9C3A8D4-7870-4193-B2D8-9003F4986610: No such file or directory
- Contributor
- February 12, 2020
- Contributor
- February 12, 2020
@khunley I recommend opening a terminal on a desktop and just copy pasting the script line by line and seeing where you're getting the hiccup.
Just by looking at that output 1.dmg doesn't exist. Are you sure your script is downloading it as 1.dmg and not something else and then a later part is trying to call 1.dmg?
- Esteemed Contributor
- February 12, 2020
Here is another VLC install script (mine). I provide the current version (3.0.8) and current SHA256 checksum (422aaf37cd12cdc49f27a5f8fa9a16d287ea8ae8f451cedc8b7a2e0b5d39c068) as $4 and $5 variables.
#!/bin/bash
# Automatically download and install VLC
if [[ -z $4 ]]; then
echo "Version not specified"
exit 1
fi
# Variables
appName="VLC.app"
dmgName="vlc-$4.dmg"
dmgVolumePath="/Volumes/VLC media player"
downloadUrl="https://download.videolan.org/pub/videolan/vlc/$4/macosx"
# Start
appPath="/Applications/${appName}"
# List version
if [[ -d "${appPath}" ]]; then
echo "${appName} version is $(defaults read "${appPath}"/Contents/Info.plist CFBundleShortVersionString)"
else
echo "${appName} not installed"
fi
# Download DMG file into /tmp/
curl -s ${downloadUrl}/${dmgName} -o "/tmp/${dmgName}"
# Verify SHA256 checksum
if [[ $(shasum -a 256 "/tmp/${dmgName}" | awk '{print $1}') == "$5" ]]; then
echo "Checksum verified"
else
echo "Checksum verification failed"
echo "Failed checksum is $(shasum -a 256 "/tmp/${dmgName}" | awk '{print $1}')"
rm -f "/tmp/${dmgName}"
exit 1
fi
# Mount DMG File
hdiutil attach "/tmp/${dmgName}" -nobrowse
# Check for successful download
if [[ ! -d "${dmgVolumePath}" ]]; then
echo "Download unsuccessful"
exit 1
fi
# Remove app if already installed
if [[ -d "${appPath}" ]]; then
rm -R "${appPath}"
echo "Removed existing copy of ${appName} from /Applications directory"
fi
# Copy application to /Applications/
cp -R "${dmgVolumePath}/${appName}" /Applications/
# Unmount DMG file
hdiutil detach "${dmgVolumePath}"
# Remove downloaded DMG file
rm -f "/tmp/${dmgName}"
# List version and exit with error code if not found
if [[ -d "${appPath}" ]]; then
echo "${appName} version is $(defaults read "${appPath}"/Contents/Info.plist CFBundleShortVersionString)"
else
echo "${appName} not installed"
exit 1
fi- Contributor
- February 12, 2020
I just used Recipe Robot to make an autopkgr recipe for VLC, the app uses sparkle so AutoPkgr will always grab the latest version based on the sparkle feed.
- Contributor
- February 18, 2020
@khunley funny thing, I just ran into a similar issue you were running into but on something unrelated.
You're getting a download issue because the script is trying to navigate to "/Library/Application Support/JAMF/" but the script is breaking because of the space in "Application Support"
Try this and tell me if it works as expected:
#!/bin/sh
temp=$TMPDIR$(uuidgen)
noMount=/Library/JAMF/tmp/$temp
mount=$noMount/mount
mkdir -p $mount
vlcVersion=`expr "$(curl "get.videolan.org/vlc/last/macosx/")" : '.*(vlc-.*.dmg)'`
curl -L get.videolan.org/vlc/last/macosx/$vlcVersion > $noMount/vlc.dmg
yes | hdiutil attach -noverify -nobrowse -mountpoint $mount $noMount/vlc.dmg
cp -r $mount/*.app /Applications
hdiutil detach $mount
rm -r $noMount
let me know if you need any more help.
- Author
- New Contributor
- July 21, 2020
@Gennaro I'm so sorry for the late reply on this. I finally tried your script and it worked perfectly! Thank you so much for the help on this!
- New Contributor
- August 27, 2021
@khunley funny thing, I just ran into a similar issue you were running into but on something unrelated.
You're getting a download issue because the script is trying to navigate to "/Library/Application Support/JAMF/" but the script is breaking because of the space in "Application Support"
Try this and tell me if it works as expected:
#!/bin/sh
temp=$TMPDIR$(uuidgen)
noMount=/Library/JAMF/tmp/$temp
mount=$noMount/mount
mkdir -p $mount
vlcVersion=`expr "$(curl "get.videolan.org/vlc/last/macosx/")" : '.*(vlc-.*.dmg)'`
curl -L get.videolan.org/vlc/last/macosx/$vlcVersion > $noMount/vlc.dmg
yes | hdiutil attach -noverify -nobrowse -mountpoint $mount $noMount/vlc.dmg
cp -r $mount/*.app /Applications
hdiutil detach $mount
rm -r $noMount
let me know if you need any more help.
Is there an updated version of this script available?
- Valued Contributor
- October 7, 2021
@khunley funny thing, I just ran into a similar issue you were running into but on something unrelated.
You're getting a download issue because the script is trying to navigate to "/Library/Application Support/JAMF/" but the script is breaking because of the space in "Application Support"
Try this and tell me if it works as expected:
#!/bin/sh
temp=$TMPDIR$(uuidgen)
noMount=/Library/JAMF/tmp/$temp
mount=$noMount/mount
mkdir -p $mount
vlcVersion=`expr "$(curl "get.videolan.org/vlc/last/macosx/")" : '.*(vlc-.*.dmg)'`
curl -L get.videolan.org/vlc/last/macosx/$vlcVersion > $noMount/vlc.dmg
yes | hdiutil attach -noverify -nobrowse -mountpoint $mount $noMount/vlc.dmg
cp -r $mount/*.app /Applications
hdiutil detach $mount
rm -r $noMount
let me know if you need any more help.
I think this is failing as there are now three variants in get.videolan.org/vlc/last/macosx/
So we need logic based on 'arch' to get the correct version or just grab the universal variant.
- Valued Contributor
- August 15, 2022
Any update on this script? I imagine that we would want to just go with the Universal installer so we don't have to maintain two policies?
- Esteemed Contributor
- August 16, 2022
Any update on this script? I imagine that we would want to just go with the Universal installer so we don't have to maintain two policies?
https://github.com/cwmcbrewster/Jamf_Scripts/blob/master/Install_VLC.sh
I provide the version as $4 and the checksum as $5. Currently that is 3.0.17.3 and cff4e9d41ced0e29f88b75cb683a8fd5c788a9492047390d2b8a3ca7e8e37456.
- Valued Contributor
- August 16, 2022
https://github.com/cwmcbrewster/Jamf_Scripts/blob/master/Install_VLC.sh
I provide the version as $4 and the checksum as $5. Currently that is 3.0.17.3 and cff4e9d41ced0e29f88b75cb683a8fd5c788a9492047390d2b8a3ca7e8e37456.
Is there a way to not have to specify a version and install whichever is current? If I left $4 and $5 empty, would that accomplish this?
- Esteemed Contributor
- August 16, 2022
Is there a way to not have to specify a version and install whichever is current? If I left $4 and $5 empty, would that accomplish this?
Try this. I made this version a while back, just haven't put it to use.
#!/bin/zsh
# Automatically download and install VLC
# Variables
appName="VLC.app"
appPath="/Applications/${appName}"
appProcessName="VLC"
dmgVolumePath="/Volumes/VLC media player"
downloadUrl="https://get.videolan.org/vlc/last/macosx"
# Try to obtain and validate dmgName
dmgName=$(curl -LSs "http://get.videolan.org/vlc/last/macosx/" | grep -E '\\"vlc-.+universal\\.dmg\\"' | awk -F\\" '{print $2}')
echo "DMG Name: ${dmgName}"
if [[ ! ${dmgName} =~ '^vlc.+\\.dmg$' ]]; then
echo "Failed to get DMG name"
exit 1
fi
cleanup () {
if [[ -f "${tmpDir}/${dmgName}" ]]; then
if rm -f "${tmpDir}/${dmgName}"; then
echo "Removed file ${tmpDir}/${dmgName}"
fi
fi
if [[ -d "${tmpDir}" ]]; then
if rm -R "${tmpDir}"; then
echo "Removed directory ${tmpDir}"
fi
fi
if [[ -d "${dmgVolumePath}" ]]; then
if hdiutil detach "${dmgVolumePath}" -quiet; then
echo "Unmounted DMG"
fi
fi
}
createTmpDir () {
if [ -z ${tmpDir+x} ]; then
tmpDir=$(mktemp -d)
echo "Temp dir set to ${tmpDir}"
fi
}
processCheck () {
if pgrep -x "${appProcessName}" > /dev/null; then
echo "${appProcessName} is currently running"
echo "Aborting install"
cleanup
exit 0
else
echo "${appProcessName} not currently running"
fi
}
tryDownload () {
if curl -LSs "${downloadUrl}/${dmgName}" -o "${tmpDir}/${dmgName}"; then
echo "Download successful"
tryDownloadState=1
else
echo "Download unsuccessful"
tryDownloadCounter=$((tryDownloadCounter+1))
fi
}
versionCheck () {
if [[ -d "${appPath}" ]]; then
echo "${appName} version is $(defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString)"
versionCheckStatus=1
else
echo "${appName} not installed"
versionCheckStatus=0
fi
}
# Start
# List version
versionCheck
# Make sure volume is not already mounted and unmount if needed
if [[ -d "${dmgVolumePath}" ]]; then
echo "${dmgVolumePath} already in use. Attempting to unmount"
hdiutil detach "${dmgVolumePath}"
fi
# Download dmg file into tmp dir (60 second timeout)
tryDownloadState=0
tryDownloadCounter=0
while [[ ${tryDownloadState} -eq 0 && ${tryDownloadCounter} -le 60 ]]; do
processCheck
createTmpDir
tryDownload
sleep 1
done
# Check for successful download
if [[ ! -f "${tmpDir}/${dmgName}" ]]; then
echo "Download unsuccessful"
cleanup
exit 1
fi
# Mount dmg file
if hdiutil attach "${tmpDir}/${dmgName}" -nobrowse -quiet; then
echo "Mounted DMG"
else
echo "Failed to mount DMG"
cleanup
exit 1
fi
# Check for expected dmg path
if [[ ! -d "${dmgVolumePath}" ]]; then
echo "Could not locate ${dmgVolumePath}"
cleanup
exit 1
fi
# Remove app if already installed
if [[ -d "${appPath}" ]]; then
if rm -R "${appPath}"; then
echo "Removed existing ${appName} from /Applications directory"
else
echo "Failed to remove existing ${appName} from /Applications directory"
cleanup
exit 1
fi
fi
# Copy application to /Applications
if cp -R "${dmgVolumePath}/${appName}" /Applications/; then
echo "Copied ${appName} to /Applications directory"
else
echo "Failed to copy ${appName} to /Applications directory"
fi
# Remove tmp dir and downloaded dmg file
cleanup
# List version and exit with error code if not found
versionCheck
if [[ ${versionCheckStatus} -eq 0 ]]; then
exit 1
fi- Valued Contributor
- August 16, 2022
Try this. I made this version a while back, just haven't put it to use.
#!/bin/zsh
# Automatically download and install VLC
# Variables
appName="VLC.app"
appPath="/Applications/${appName}"
appProcessName="VLC"
dmgVolumePath="/Volumes/VLC media player"
downloadUrl="https://get.videolan.org/vlc/last/macosx"
# Try to obtain and validate dmgName
dmgName=$(curl -LSs "http://get.videolan.org/vlc/last/macosx/" | grep -E '\\"vlc-.+universal\\.dmg\\"' | awk -F\\" '{print $2}')
echo "DMG Name: ${dmgName}"
if [[ ! ${dmgName} =~ '^vlc.+\\.dmg$' ]]; then
echo "Failed to get DMG name"
exit 1
fi
cleanup () {
if [[ -f "${tmpDir}/${dmgName}" ]]; then
if rm -f "${tmpDir}/${dmgName}"; then
echo "Removed file ${tmpDir}/${dmgName}"
fi
fi
if [[ -d "${tmpDir}" ]]; then
if rm -R "${tmpDir}"; then
echo "Removed directory ${tmpDir}"
fi
fi
if [[ -d "${dmgVolumePath}" ]]; then
if hdiutil detach "${dmgVolumePath}" -quiet; then
echo "Unmounted DMG"
fi
fi
}
createTmpDir () {
if [ -z ${tmpDir+x} ]; then
tmpDir=$(mktemp -d)
echo "Temp dir set to ${tmpDir}"
fi
}
processCheck () {
if pgrep -x "${appProcessName}" > /dev/null; then
echo "${appProcessName} is currently running"
echo "Aborting install"
cleanup
exit 0
else
echo "${appProcessName} not currently running"
fi
}
tryDownload () {
if curl -LSs "${downloadUrl}/${dmgName}" -o "${tmpDir}/${dmgName}"; then
echo "Download successful"
tryDownloadState=1
else
echo "Download unsuccessful"
tryDownloadCounter=$((tryDownloadCounter+1))
fi
}
versionCheck () {
if [[ -d "${appPath}" ]]; then
echo "${appName} version is $(defaults read "${appPath}/Contents/Info.plist" CFBundleShortVersionString)"
versionCheckStatus=1
else
echo "${appName} not installed"
versionCheckStatus=0
fi
}
# Start
# List version
versionCheck
# Make sure volume is not already mounted and unmount if needed
if [[ -d "${dmgVolumePath}" ]]; then
echo "${dmgVolumePath} already in use. Attempting to unmount"
hdiutil detach "${dmgVolumePath}"
fi
# Download dmg file into tmp dir (60 second timeout)
tryDownloadState=0
tryDownloadCounter=0
while [[ ${tryDownloadState} -eq 0 && ${tryDownloadCounter} -le 60 ]]; do
processCheck
createTmpDir
tryDownload
sleep 1
done
# Check for successful download
if [[ ! -f "${tmpDir}/${dmgName}" ]]; then
echo "Download unsuccessful"
cleanup
exit 1
fi
# Mount dmg file
if hdiutil attach "${tmpDir}/${dmgName}" -nobrowse -quiet; then
echo "Mounted DMG"
else
echo "Failed to mount DMG"
cleanup
exit 1
fi
# Check for expected dmg path
if [[ ! -d "${dmgVolumePath}" ]]; then
echo "Could not locate ${dmgVolumePath}"
cleanup
exit 1
fi
# Remove app if already installed
if [[ -d "${appPath}" ]]; then
if rm -R "${appPath}"; then
echo "Removed existing ${appName} from /Applications directory"
else
echo "Failed to remove existing ${appName} from /Applications directory"
cleanup
exit 1
fi
fi
# Copy application to /Applications
if cp -R "${dmgVolumePath}/${appName}" /Applications/; then
echo "Copied ${appName} to /Applications directory"
else
echo "Failed to copy ${appName} to /Applications directory"
fi
# Remove tmp dir and downloaded dmg file
cleanup
# List version and exit with error code if not found
versionCheck
if [[ ${versionCheckStatus} -eq 0 ]]; then
exit 1
fiI will give it a go! Thank you!
- Contributor
- October 12, 2022
Hey KHunley,
This script worked for me, Talking Moose knows his stuff. I created a script within Jamf and just copied and pasted Talking Moose script off of git hub. Deployed it as a policy and worked like a champ.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Scanning file for viruses.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
OKThis file cannot be downloaded
Sorry, our virus scanner detected that this file isn't safe to download.
OK