Skip to content

brew shellenv output incorrect for tcsh #20724

@webdeck

Description

@webdeck

brew doctor output

Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Some installed formulae are deprecated or disabled.
You should find replacements for the following formulae:
  icu4c@76
  terraform

Verification

brew config output

HOMEBREW_VERSION: 4.6.11
ORIGIN: https://github.com/Homebrew/brew
HEAD: 6c44d1a8f1bd7ca44c3f13c4e3694cdff40483a2
Last commit: 4 days ago
Branch: stable
Core tap JSON: 18 Sep 20:05 UTC
Core cask tap JSON: 18 Sep 20:05 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_EDITOR: /opt/homebrew/bin/emacs
HOMEBREW_FORBID_PACKAGES_FROM_PATHS: set
HOMEBREW_MAKE_JOBS: 16
Homebrew Ruby: 3.4.5 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.4.5/bin/ruby
CPU: 16-core 64-bit arm_brava
Clang: 17.0.0 build 1700
Git: 2.50.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 26.0-arm64
CLT: 26.0.0.0.1.1757719676
Xcode: 26.0
Rosetta 2: false

What were you trying to do (and why)?

brew shellenv produces output that results in a syntax error for the tcsh shell.

What happened (include all command output)?

% echo $SHELL
/bin/tcsh
% eval `/opt/homebrew/bin/brew shellenv`
PATH_HELPER_ROOT=/opt/homebrew: Command not found.

This is because line 4 of the brew shellenv is illegal syntax for tcsh/csh:

% /opt/homebrew/bin/brew shellenv
setenv HOMEBREW_PREFIX /opt/homebrew;
setenv HOMEBREW_CELLAR /opt/homebrew/Cellar;
setenv HOMEBREW_REPOSITORY /opt/homebrew;
eval `PATH_HELPER_ROOT="/opt/homebrew" /usr/libexec/path_helper -c`;
test ${?MANPATH} -eq 1 && setenv MANPATH :${MANPATH};
setenv INFOPATH /opt/homebrew/share/info`test ${?INFOPATH} -eq 1 && echo :${INFOPATH}`;

What did you expect to happen?

eval `/opt/homebrew/bin/brew shellenv`

works for tcsh

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

While using the tcsh shell:

eval `/opt/homebrew/bin/brew shellenv`

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