Skip to content

alias: calling with --edit and without arguments edits ~/.brew-aliases directory #24727

Not planned

Description

@carenas

brew doctor output

Warning: /usr/bin occurs before /opt/homebrew/bin in your PATH.
This means that system-provided programs will be used instead of those
provided by Homebrew.

The following tools exist at both paths:
  corelist
  cpan
  enc2xs
  encguess
  h2ph
  h2xs
  instmodsh
  json_pp
  libnetcfg
  openssl
  perl
  perlbug
  perldoc
  perlivp
  perlthanks
  piconv
  pip3
  pl2pm
  pod2html
  pod2man
  pod2text
  pod2usage
  podchecker
  prove
  ptar
  ptardiff
  ptargrep
  python3
  shasum
  splain
  streamzip
  xsubpp
  zipdetails

Consider setting your PATH for example like so:
  printf '%s\n' export\ PATH\=/opt/homebrew/bin:\$PATH >> ~/.zshrc

Warning: Homebrew's "sbin" was not found in your PATH but you have installed
formulae that put executables in /opt/homebrew/sbin.

Consider setting your PATH for example like so:
  printf '%s\n' export\ PATH\=/opt/homebrew/sbin:\$PATH >> ~/.zshrc

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • I have supplied my brew doctor output above and it seems unrelated to my issue.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.
  • I did not use AI/LLM to create this issue, or I disclosed the tool and model used; I will answer maintainer questions myself without AI/LLM.

brew config output

HOMEBREW_VERSION: 7.0.15
ORIGIN: https://github.com/Homebrew/brew
HEAD: 3e47189a707c739ee1278a28a3b845f5834574e6
Last commit: 2 days ago
Branch: stable
Core tap: N/A
Core cask tap: N/A
HOMEBREW_PREFIX: /opt/homebrew
Homebrew Ruby: 4.0.10 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/4.0.10/bin/ruby
CPU: octa-core 64-bit arm_blizzard_avalanche
Clang: 21.0.0 build 2100
Git: 2.54.0 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 27.2.1-arm64
CLT: 27.2.0.0.1792721180
Xcode: N/A
Rosetta 2: false

What were you trying to do (and why)?

create an alias without realizing that I needed to provide a name for it if using --edit

What happened (include all command output)?

brew alias --edit invokes $EDITOR (in my case Apple's vi) which opens the directory and prints a text representation of its contents that look like:

" ============================================================================
" Netrw Directory Listing                                        (netrw v184)
"   /Users/carenas/.brew-aliases
"   Sorted by      name
"   Sort sequence: [\/]$,*,\(\.bak\|\~\|\.o\|\.h\|\.info\|\.swp\|\.obj\)[*@]\=$
"   Quick Help: <F1>:help  -:go up dir  D:delete  R:rename  s:sort-by  x:special
" ==============================================================================
../                                                                                                                                                                                                            
./

What did you expect to happen?

an error like:

Usage: brew alias [--edit] [alias|alias=command]

Show an alias's command. If no alias is given, print the whole list.

      --edit                       Edit aliases in a text editor. Either one or
                                   all aliases may be opened at once. If the
                                   given alias doesn't exist it'll be
                                   pre-populated with a template.
  -d, --debug                      Display any debugging information.
  -q, --quiet                      Make some output more quiet.
  -v, --verbose                    Make some output more verbose.
  -h, --help                       Show this message.

Error: Invalid usage: need an alias when using option: --edit

Step-by-step reproduction instructions (running brew commands)

brew alias --edit

Activity

  1. added theissue type on Nov 21, 2026
  2. MikeMcQuaid commented on Nov 21, 2026

    @MikeMcQuaid
    Member

    This is intentional behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions