Homebrew cask support
A lot of useful packages come from Cask, which is now included as part of Homebrew itself.
To use them from Homebrew, you are supposed to use brew cask instead of just brew. For example, the correct command to install gimp would be: brew cask install gimp
Here is an example of pacapt failing to install gimp:
$ pacapt -S gimp
Error: No available formula with the name "gimp"
It was migrated from homebrew/core to homebrew/cask.
You can access it again by running:
brew tap homebrew/cask
And then you can install it by running:
brew cask install gimp
@ryepesg Does this only affect the installation option? Does brew return any specific error when it suggests to use brew cask? Can you please have the output of the following attempt:
$ pacapt -S gimp; echo $?
$ brew tap homebrew/cask; echo $?
A fallback mechanism can be added to https://github.com/icy/pacapt/blob/ng/lib/homebrew.sh#L138 . I have no Mac to test:(
@icy Yes, my use case is only for (un)install, other operations like search already work fine. Here are the outputs for the commands you mentioned:
% pacapt -S gimp; echo $?
Error: No available formula with the name "gimp"
It was migrated from homebrew/core to homebrew/cask.
You can access it again by running:
brew tap homebrew/cask
And then you can install it by running:
brew cask install gimp
1
% brew tap homebrew/cask; echo $?
0
Here are some other commands just in case. Happy to continue doing some testing on Mac.
% pacapt -R gimp Error: No such keg: /usr/local/Cellar/gimp 1
% brew uninstall gimp Error: No such keg: /usr/local/Cellar/gimp 1
% brew cask uninstall gimp ==> Uninstalling Cask gimp ==> Backing App 'GIMP-2.10.app' up to '/usr/local/Caskr ==> Removing App '/Applications/GIMP-2.10.app'. ==> Purging files for version 2.10.8,2 of Cask gimp 0
This is tricky. I expect brew (without cast) returns something more interesting . Parsing brew output message may not be a good idea, but let me give a try.
@ryepesg Please check out the new script https://raw.githubusercontent.com/icy/pacapt/fix_117/pacapt if that helps. I don't have a Mac/homebrew to test (well, my Mac installation was replaced by Arch stuff.) If you get the idea of my fix you may try to get around in case of problem. I will also ask some friends for tests.
Thanks a lot.
note, this work is on a new branch fix_117. If everything goes fine I will cherry-pick the results on the ng branch.
Hi @icy, I just tested but it didn't work. Here is how I tested:
/tmp/pacapt (git)-[ng] % git checkout -b fix_117 Switched to a new branch 'fix_117' /tmp/pacapt (git)-[fix_117] % git merge origin/fix_117 Updating b0c374a..be3e7e9 Fast-forward lib/homebrew.sh | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- pacapt | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 112 insertions(+), 9 deletions(-) /tmp/pacapt (git)-[fix_117] % ./pacapt -S gimp Error: No available formula with the name "gimp" It was migrated from homebrew/core to homebrew/cask. You can access it again by running: brew tap homebrew/cask And then you can install it by running: brew cask install gimp 1 /tmp/pacapt (git)-[fix_117] % brew cask install gimp ==> Satisfying dependencies ==> Downloading https://download.gimp.org/pub/gimp/v2.10/osx/gimp-2.10.8-x86_64-2.dmg Already downloaded: /Users/r/Library/Caches/Homebrew/downloads/85ee7c4a7929b7b9cb5371062aab3f796267390e4d3b9dd8b5e55d3116b310ff--gimp-2.10.8-x86_64-2.dmg ==> Verifying SHA-256 checksum for Cask 'gimp'. ==> Installing Cask gimp ==> Moving App 'GIMP-2.10.app' to '/Applications/GIMP-2.10.app'. 🍺 gimp was successfully installed! brew cask install gimp 9.97s user 16.94s system 51% cpu 52.532 total /tmp/pacapt (git)-[fix_117] % ./pacapt -Rn gimp homebrew: 'R:n:' operation is invalid or not implemented. 1 /tmp/pacapt (git)-[fix_117] % ./pacapt -R gimp :( Error: No such keg: /usr/local/Cellar/gimp 1 /tmp/pacapt (git)-[fix_117] % brew uninstall gimp :( Error: No such keg: /usr/local/Cellar/gimp 1 /tmp/pacapt (git)-[fix_117] % brew cask uninstall gimp :( ==> Uninstalling Cask gimp ==> Backing App 'GIMP-2.10.app' up to '/usr/local/Caskroom/gimp/2.10.8,2/GIMP-2.10.app'. ==> Removing App '/Applications/GIMP-2.10.app'. ==> Purging files for version 2.10.8,2 of Cask gimp brew cask uninstall gimp 1.46s user 6.75s system 81% cpu 10.124 total
@ryepesg Thanks a lot for your feedback. I will have a look.
I have a Mac OS now, I will have some tests and fixes this week.
Any updates on this issue? :)
@rami3l sorry... I'm gonna fix that today. I didn't know how to use my Mac lolz
Should be fixed in the latest release v2.4.3 (pr: #127 )
Should be fixed in the latest release v2.4.3 (pr: #127 )
I don't know much about bash scripting, but if I am not mistaken, only the -S behavior is updated this time.
I believe the use of brew cask should also be implemented for a few commands more (-R, -Su and -Syu) in a similar way, maybe as once done here.
But anyway, thanks a lot for the fix! :)
Oh you're right, @rami3l . I was too fast. Hold my beer I will fix it again :)
It's not so easy as I expected :) Look at the WIP: https://github.com/icy/pacapt/pull/128/files
I'm not staying frequently with my Mac -- my main workstation is on Linux. This work would take more time and effort, hopefully I can fix it soon: At least, I can have home/brew here :)
Will continue this weekend . Thx
An update:
Brew Cask now does not need the brew cask command to work, instead it works with standard brew. If the cask version of the formula is needed, the --cask flag can be used, as in brew install --cask foo .
cask is now not required :D
Thank you very much everyone!