-
-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
brew edit <formula>
open the formula executable in editor
#14895
Comments
Thanks for the issue!
Makes me think it may be related to the current working directory you are in. Can you reproduce if you do this?
Do these reproduce on all machines? |
Indeed, the current directory is the problem. On the computer where I detected the issue I ran the I think that I can provide reproducible step-by-step instructions.
|
Essentially we use the brew/Library/Homebrew/cli/named_args.rb Lines 195 to 228 in 58f7cb0
I'm not sure I understand why it'd be super useful to be able to load from a path in this command. In fact, looking at the other commands where this same method is used I feel the same way about them too. We already had to deprecate this behavior in the It's used in the following commands:
Of those |
We'd probably have to go through the whole deprecation cycle to remove the ability to pass paths to these commands (other than |
Thanks for jogging my memory here @apainintheneck. Yes, annoyingly this is desired behaviour by some users/commands and not other users/commands. I know this is used heavily for e.g. |
I don't really understand what the use case is here. If you already know the path, you can just open it in your editor with |
brew doctor
outputVerification
brew doctor
output" above saysYour system is ready to brew.
and am still able to reproduce my issue.brew update
twice and am still able to reproduce my issue.brew install wget
. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.brew config
outputWhat were you trying to do (and why)?
I ran
brew edit vault
to see some details about the formula definition. Homebrew opened the binary executablevault
in my editor (vi
).Context: After I upgraded Homebrew to version 4, a couple of weeks ago, I untapped
homebrew/core
.I understand that the formula definition is not available locally any more and consequently cannot be edited. But opening the executable in
vi
does not look like a good idea.What happened (include all command output)?
vi
started and opened a binary file, probably/usr/local/bin/vault
.When I exited
vi
, the output ofbrew
on terminal was:I re-tapped
homebrew/core
and tried again. Nothing changed;brew edit vault
still opens thevault
executable.However, for some formulae,
brew edit
works as expected and opens the formula definition file in editor (vi
).Example "good" formulae:
awscli
,php
,[email protected]
,nvm
,bash-completion@2
,postgresql@14
etc.For other formulae, it opens the binary executable:
vault
,mysql
,jq
,redis
etc.Note: All the formulae listed above are installed. I think that
brew edit
correctly opens the formula definition file for formulae that are not installed (or, at least, I tried about a dozen and could not find any problem.)I uninstalled
jq
and thenbrew edit jq
worked fine. I installedjq
again andbrew edit jq
reverted to opening the binary executable.It could be related to the macOS version or Ruby version. I tried on two other MBPs running macOS 12 (Monterey) and I could not reproduce the behaviour.
This is the output on one of them:
Please remark that it opens the formula definition cached next to the executable, not the one from the Homebrew installation directory.
The output of
brew config
on the Monterey system (the one that works fine) is below. I did not re-taphomebrew/core
on it becausebrew edit
works fine.What did you expect to happen?
If the tap
homebrew/core
is available locally, I expect that Homebrew starts my editor (vi
) to edit the file/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/vault.rb
.If the tap
homebrew/core
is not available locally, it can show an error message and (preferably) directions about how to get the formula definition (brew tap
etc.)Step-by-step reproduction instructions (by running
brew
commands)The text was updated successfully, but these errors were encountered: