Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Query homebrew for package list on macOS #140

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

anthroid
Copy link

Query brew for package list instead of using the hard-coded /usr/local/Cellar/* path. The homebrew installation path is configurable, and for instance, uses /opt/homebrew on Apple Silicon (https://docs.brew.sh/FAQ#why-is-the-default-installation-prefix-opthomebrew-on-apple-silicon).

@dylanaraps
Copy link
Owner

What does this do for execution times? How long does it take to fetch packages now?

@anthroid
Copy link
Author

What does this do for execution times?

Nothing. Right now it doesn't return any packages on Apple Silicon because the path glob is hard-coded to /usr/local/Cellar/*. By default, Homebrew installs to /opt/homebrew instead of /usr/local on Apple Silicon, and this path is also configurable by the user, so it could be anywhere. Running brew --cellar just returns the configured Homebrew installation path, and then that path is globbed.

How long does it take to fetch packages now?

If I run the current version 100x in a loop, then swap out the path with $(brew --cellar) and repeat, I get an average increase of 0.0059s per pfetch command.

@anthroid
Copy link
Author

Also, one other thing - The exact same command is run a few lines above this under Linux.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants