1

I wish to run brew cask upgrade in a cronjob, but it prompts for a password.

When I run the job as root all permissions are screwed up.

Howto run that command in a cronjob env? I use zsh.

~ brew cask upgrade
==> Casks with `auto_updates` or `version :latest` will not be upgraded
==> Upgrading 2 outdated packages:
java 13.0.1,9:cec27d702aa74d5a8630c65ae61e4305 -> 13.0.2,8:d4173c853231432d94f001e99d882ca7, keepassxc 2.5.2 -> 2.5.3
==> Upgrading java
==> Downloading https://download.java.net/java/GA/jdk13.0.2/d4173c853231432d94f001e99d882ca7/8/GPL/openjdk-13.0.2_osx-x64_bin.tar.gz
######################################################################## 100.0%
==> Verifying SHA-256 checksum for Cask 'java'.
==> Backing Generic Artifact 'openjdk-13.0.1.jdk' up to '/usr/local/Caskroom/java/13.0.1,9:cec27d702aa74d5a8630c65ae61e4305/jdk-13.0.1.jdk'.
Password:
  • 3
    IMHO there is no need for an additional „cask“ tag in addition to „homebrew“. If you want to propose a new tag, please do so on Meta so the community can join the discussion. – nohillside Jan 20 '20 at 16:34
  • 2
    Keep in mind that cron is deprecated for launchd. This might be a good time to get some experience with that utility. – Allan Jan 20 '20 at 22:59
0

I have tried using cron as well but it just won't go as well. Instead I wrote a script called macupdate that held the instructions for homebrew to upgrade all installed apps as well as for the mac to look for and download any MacOS updates, made it executable and selected it as a startup application.

brew update && brew upgrade && brew cask upgrade --greedy; mas upgrade;
sudo softwareupdate -i -a --restart
  • I don’t see the sudo password part – Ivanov Jan 20 '20 at 16:45
  • When you run it like I do you don't have to enter it. – Roman Koschar Jan 21 '20 at 6:58
  • How do you run it so it doesn't need a password? Can you add some details so others can reproduce? – nohillside Nov 3 '20 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .