Installing VLC macOS 10.15

khunley
New Contributor

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.

13 REPLIES 13

larry_barrett
Valued Contributor

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.

wmayhone
New Contributor III

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

wmayhone
New Contributor III

Granted you may need to update the version.

Gennaro
New Contributor III
#!/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!

khunley
New Contributor

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

Gennaro
New Contributor III

@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?

cbrewer
Valued Contributor II

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

drtaru
New Contributor III

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.

Gennaro
New Contributor III

@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.

ddixon
New Contributor II

Is there an updated version of this script available?

I think this is failing as there are now three variants in get.videolan.org/vlc/last/macosx/

  1. vlc-3.0.16-arm64.dmg
  2. vlc-3.0.16-intel64.dmg
  3. vlc-3.0.16-universal.dmg

So we need logic based on 'arch' to get the correct version or just grab the universal variant.

 

 

khunley
New Contributor

@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!