Jump to content

Manage Homebrew Casks with Alfred

Recommended Posts

  • 4 months later...

There’s another consideration here. By not sourcing the users’ shell startup files, it can possibly behave differently than from the command line, as it won’t be including homebrew-cask’s options. A warning on the top post that users will need to reproduce these in the workflow (if they have any of them set) would be a good idea, as not doing it can mess organisation quite a bit, like installing and linking to different directories.

On another note, you have some unnecessary code in the workflow. You’re doing


sh cask.sh <arguments>
However, #!/bin/bash is not needed, as Alfred is already taking care of using the correct interpreter. Furthermore, by issuing sh cask.sh you’re actually telling the shell to call another shell to execute the script. You should make the script executable (once, on your side, via chmod +x ./cask.sh), and substitute sh cask.sh <arguments> in the workflow with ./cask.sh <arguments>.
Link to comment

Apologies if it was insulting in any way. I don’t intend to use the workflow, but as a homebrew-cask collaborator and avid Alfred user, it interested me, which is why I mentioned the options case as that can break the workflow of unsuspecting users.

It is also so common in these forums (due to Alfred’s workflows being so powerful an easy to use) to find users with little scripting experience (which I now see is not your case), that I got into the habit of explaining in detail how (and why) to make suggested changes. Making code shorter and at the same time more efficient is always good, and my point is simply that Alfred is already good at making some right decisions for us.

Link to comment

No worries, I'm not insulted and I agree with you.


As a contributor to the homebrew-cask project and the guy who wrote the brew-cask plugin bundled with oh-my-zsh, I hope you keep up the good work! There's definitely potential in this project. Are there any plans regarding a GUI app for the non-devs out there?

Link to comment

I just pushed a new version.



- ~/.bash_profile and ~/.profile are now sourced if available (thanks andi-w00t)

- cask.sh is now executed without spawning a subshell.

Edited by Patrick Stadler
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...