Hdiutil fails when using "brew cask install"

Our build has used Chrome in selenium on a Mac stack for a few months now and as of today (last successful build was 4 days ago), the step to install Chrome fails on every build because of hdiutil apparently failing.

+ brew cask install Caskroom/cask/google-chrome
Warning: /usr/local is not writable, sudo is needed to move the Caskroom.
==> Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX
==> Satisfying dependencies
complete
==> Downloading https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg
==> No checksum defined for Cask google-chrome, skipping verification
==> Installing Cask google-chrome
Error: Command failed to execute!

==> Failed command:
/usr/bin/hdiutil mount -plist -nobrowse -readonly -noidme -mountrandom /tmp #<Pathname:/Users/vagrant/Library/Caches/Homebrew/Cask/google-chrome--latest.dmg>

==> Standard Output of failed command:


==> Standard Error of failed command:


==> Exit status of failed command:

I’m somewhat assuming something has changed over the weekend, which is now breaking this all the time.

1 Like

Did you try it with sudo, like sudo brew cask install ...?

Based on the warning line Warning: /usr/local is not writable, sudo is needed to move the Caskroom. that’s the most likely cause I think.

As always, you can find the changes at Changelog, this weekend’s changelog: Weekly Virtual Machine / Stack updates - 2017.04.29

If you have any questions please let us know!

Turns out (and thanks to @viktorbenei for the suggestion), that a brew update fixes it.

1 Like

Thanks for reporting @seanparsons! :wink:

Just for future reference, this means that instead of just

brew cask install Caskroom/cask/google-chrome

you run

brew update && brew cask install Caskroom/cask/google-chrome

To first update the brew “registry”, and then install the latest version of the package.

Just to add, running brew update first can also avoid problems with mismatched checksums like the one below, so it’s always recommended to run brew update && brew cask install <formula>.

+ brew cask install google-chrome
==> Satisfying dependencies
==> Downloading https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg
Error: Checksum for Cask 'google-chrome' does not match.
Expected: 86c3885a1341f5b2d90900746dddd555cf7a31dcfae629ccc731391ff278177a
Actual:   9f85337a9bbaf7bdde5ce394eb309a2ea3335f1405744bc72d27993ca919e883
File:     /Users/vagrant/Library/Caches/Homebrew/Cask/google-chrome--62.0.3202.94.dmg
To retry an incomplete download, remove the file above.
==> Verifying checksum for Cask google-chrome
==> Note: running "brew update" may fix sha256 checksum errors
1 Like

Thanks for the note @markcharacterscope! :slight_smile: