homebrew-cask: undefined method `undent'

General troubleshooting steps

  • I have retried my command with --force and the issue is still present.
  • I have checked the instructions for reporting bugs.
  • None of the templates was appropriate for my issue, or I’m not sure.
  • I ran brew update-reset && brew update and retried my command.
  • I ran brew doctor, fixed as many issues as possible and retried my command.
  • I understand that if I ignore these instructions, my issue may be closed without review.

Description of issue

I am trying to do a brew cask upgrade --greedy, but I get an error related to an undefined method on it.

Command that failed

brew cask upgrade --greedy

Output of command with --force --verbose --debug

==> Casks with `auto_updates` or `version :latest` will not be upgraded
==> Upgrading 1 outdated package, with result:
powershell 6.0.2
==> Started upgrade process for Cask powershell
Error: undefined method `undent' for #<String:0x00007f9f3525c098>
Follow the instructions here:
  https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Caskroom/powershell/.metadata/6.0.0-beta.8/20171012033107.351/Casks/powershell.rb:35:in `block in load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:36:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask.rb:36:in `initialize'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:31:in `new'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:31:in `cask'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:67:in `cask'
/usr/local/Homebrew/Library/Homebrew/compat/hbc/cask_loader.rb:15:in `cask'
/usr/local/Caskroom/powershell/.metadata/6.0.0-beta.8/20171012033107.351/Casks/powershell.rb:1:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:57:in `instance_eval'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:57:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cask_loader.rb:170:in `load'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb:37:in `block in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb:33:in `each'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/upgrade.rb:33:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli/abstract_command.rb:33:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:93:in `run_command'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:157:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:122:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:7:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'
Error: Kernel.exit
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `exit'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:168:in `rescue in run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:145:in `run'
/usr/local/Homebrew/Library/Homebrew/cask/lib/hbc/cli.rb:122:in `run'
/usr/local/Homebrew/Library/Homebrew/cmd/cask.rb:7:in `cask'
/usr/local/Homebrew/Library/Homebrew/brew.rb:100:in `<main>'

Output of brew cask doctor

==> Homebrew-Cask Version
Homebrew-Cask 1.7.0-9-gc47d515
Homebrew/homebrew-cask (git revision ba212; last commit 2018-07-16)
==> macOS
10.13.6
==> SIP
Enabled
==> Java
1.8.0_151
==> Homebrew-Cask Install Location
<NONE>
==> Homebrew-Cask Staging Location
/usr/local/Caskroom
==> Homebrew-Cask Cached Downloads
~/Library/Caches/Homebrew/Cask (6 files, 83.4MB)
==> Homebrew-Cask Taps:
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask (3996 casks)
==> Contents of $LOAD_PATH
/usr/local/Homebrew/Library/Homebrew
/usr/local/Homebrew/Library/Homebrew/cask/lib
/Library/Ruby/Gems/2.3.0/gems/did_you_mean-1.0.0/lib
/Library/Ruby/Site/2.3.0
/Library/Ruby/Site/2.3.0/x86_64-darwin17
/Library/Ruby/Site/2.3.0/universal-darwin17
/Library/Ruby/Site
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0/x86_64-darwin17
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby/2.3.0/universal-darwin17
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/vendor_ruby
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/x86_64-darwin17
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin17
==> Environment Variables
LC_ALL="en_US.UTF-8"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Homebrew/Library/Homebrew/shims/scm"
SHELL="/bin/bash

Output of brew tap

homebrew/cask
homebrew/core

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 9
  • Comments: 17 (11 by maintainers)

Most upvoted comments

My manual workaround for the error:

Error: undefined method `undent' for #<String:0x00000001029af2d8>
Follow the instructions here:
  https://github.com/Homebrew/homebrew-cask#reporting-bugs
/usr/local/Caskroom/jce-unlimited-strength-policy/.metadata/1.8/20170518201102.343/Casks/jce-unlimited-strength-policy.rb:65:in `block in load'

was to edit /usr/local/Caskroom/jce-unlimited-strength-policy/.metadata/1.8/20170518201102.343/Casks/jce-unlimited-strength-policy.rb and remove the .undent.

This fixed: brew cu.

I then removed this old cask with: brew cask uninstall jce-unlimited-strength-policy

I see two solutions. Either readd String#undent or add a migration which replaces all occurrences of <<-EOS.undent with <<~EOS in Caskroom.

See https://github.com/Homebrew/brew/issues/4494. Should be fixed soon. Thank you for the report.