Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Homebrew cask support #117

Closed
ryepesg opened this issue Jan 8, 2019 · 18 comments
Closed

Homebrew cask support #117

ryepesg opened this issue Jan 8, 2019 · 18 comments

Comments

@ryepesg
Copy link

ryepesg commented Jan 8, 2019

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
@icy
Copy link
Owner

icy commented Jan 15, 2019

@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:(

@ryepesg
Copy link
Author

ryepesg commented Jan 16, 2019

@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

@icy
Copy link
Owner

icy commented Jan 16, 2019

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.

icy added a commit that referenced this issue Jan 16, 2019
icy added a commit that referenced this issue Jan 16, 2019
@icy
Copy link
Owner

icy commented Jan 16, 2019

@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.

@icy
Copy link
Owner

icy commented Jan 16, 2019

note, this work is on a new branch fix_117. If everything goes fine I will cherry-pick the results on the ng branch.

icy added a commit that referenced this issue Jan 16, 2019
@icy icy self-assigned this Jan 16, 2019
icy added a commit that referenced this issue Jan 17, 2019
@ryepesg
Copy link
Author

ryepesg commented Jan 19, 2019

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

@icy
Copy link
Owner

icy commented Jan 19, 2019

@ryepesg Thanks a lot for your feedback. I will have a look.

@icy
Copy link
Owner

icy commented Oct 1, 2019

I have a Mac OS now, I will have some tests and fixes this week.

@rami3l
Copy link
Collaborator

rami3l commented Feb 15, 2020

Any updates on this issue? :)

@icy
Copy link
Owner

icy commented Feb 15, 2020

@rami3l sorry... I'm gonna fix that today. I didn't know how to use my Mac lolz

@icy icy closed this as completed in ecf2a41 Feb 15, 2020
@icy
Copy link
Owner

icy commented Feb 15, 2020

Should be fixed in the latest release v2.4.3 (pr: #127 )

@rami3l
Copy link
Collaborator

rami3l commented Feb 16, 2020

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! :)

@icy
Copy link
Owner

icy commented Feb 16, 2020

Oh you're right, @rami3l . I was too fast. Hold my beer I will fix it again :)

@icy icy reopened this Feb 16, 2020
@t2bhuyen
Copy link

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 :)

@icy
Copy link
Owner

icy commented Feb 20, 2020

Will continue this weekend . Thx

@fracturedprism
Copy link

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 .

@icy icy added the PR ready label Jun 17, 2021
@icy
Copy link
Owner

icy commented Jun 17, 2021

cask is now not required :D

@icy icy removed their assignment Dec 23, 2022
@ryepesg
Copy link
Author

ryepesg commented Feb 21, 2023

Thank you very much everyone!

@ryepesg ryepesg closed this as completed Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants