Here I put the final solution. I tried many methods on my mac M1, the best method is re-install homebrew.

Step1:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh)"

Step2: Install homebrew

cd /opt 
mkdir homebrew # if not exist, just create one.
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

Then, the problem solved.

Answer from Frank on Stack Overflow
🌐
Apple Community
discussions.apple.com › thread › 254967682
zsh: killed - Apple Community
ZSH ISSUES - PLEASE CAN ANYONE HELP Every time I boot up recently I get this message in Terminal: Last login: Tue Feb 27 08:48:57 on ttys000 vickig***@Vickis-Macbook-Air ~ % [Restored 27 Feb 2024 at 08:50:16] Last login: Tue Feb 27 08:49:11 on ttys000 /Users/vickig****/.zsh_sessions/DF24BAAF-57CA-418A-975D-22D64****.session:2: command not found: Saving vickiga***@Vickis-Macbook-Air ~ % How do I make it go away?
🌐
Reddit
reddit.com › r/youtubedl › "zsh: killed" error immediately after every command on m1 macbook
r/youtubedl on Reddit: "ZSH: Killed" Error immediately after every command on M1 MacBook
February 11, 2021 -

Hi, I'm pretty new to homebrew and the whole command line thing on the Mac, so please be kind ;) Every time I try to use YouTube-DL this happens:

youtube-dl --verbose "https://www.youtube.com/watch?v=lKeUCkBO8QA" zsh: killed youtube-dl --verbose "https://www.youtube.com/watch?v=lKeUCkBO8QA"

I spend hours googling for help, but I couldn't find anything. Can someone please explain to me what's going on there and wtf is killing that process?

Btw I got Vidl installed also.

🌐
Apple Community
discussions.apple.com › thread › 254910900
Terminal zsh:killed - Apple Community
June 7, 2023 - ZSH ISSUES - PLEASE CAN ANYONE ... work project and am nervous! [Edited by Moderator] 645 3 ... This means that something that was added to one of the files like .zshrc is causing trouble....
🌐
Super User
superuser.com › questions › 1733858 › terminal-commands-which-dirname-curl-and-more-are-all-being-killed-by-zsh-a
Terminal commands (which, dirname, curl, and more) are all being killed by Zsh and don’t work in macOS on an M1-based Mac - Super User
July 27, 2022 - I think you're misinterpreting the ZSH output. It just informs you that the command was killed, not who did it. // The error message is pretty clear and should get you good results if researched. ... What do you mean by "beta OS to macOS"?
🌐
Medium
medium.com › @fraycs › how-to-solve-zsh-killed-on-macos-ventura-5c1b01d1ed8a
How to solve zsh: killed on MacOS Ventura | by Sebastían Pulido | Medium
February 1, 2023 - Sometimes when installing Homebrew or when you install Ruby, Git, some Python package, through Homebrew. You screw up with your .zshrc and .zprofile and you have no idea how to get it back.
🌐
Apple Developer
developer.apple.com › forums › thread › 698167
ZSH Won't Run an M1 Command Line T… | Apple Developer Forums
January 11, 2022 - Understood. The zsh: killed TOOL_NAME message you’re reporting indicates that the process died with a SIGKILL, which is commonly associated with a code signing error.
Find elsewhere
🌐
Super User
superuser.com › questions › 1793132 › zsh-killed-in-terminal
macos - zsh: killed in Terminal - Super User
July 2, 2023 - After trying to install mongoDB on macOS Ventura, I'm getting error zsh: killed. When I open Terminal, I see: zsh: killed mkdir -m 700 -p "$SHELL_SESSION_DIR" Whenever I try to run a com...
🌐
GitHub
github.com › pocketbase › pocketbase › discussions › 5168
zsh: killed ./app · pocketbase/pocketbase · Discussion #5168
July 3, 2024 - By googling zsh: killed this seems to be a common issue and could be returned for a lot of reasons, including permission issues or missing C tooling dependencies if you have CGO_ENABLED=1 by default.
Author   pocketbase
🌐
MacRumors
forums.macrumors.com › macs › macos › older macos versions › macos high sierra (10.13)
Unable to reinstall High Sierra | MacRumors Forums
January 18, 2025 - That “zsh: killed” error usually means the Mac ran out of memory or something else interrupted the process. But honestly, trying to create the installer yourself from a High Sierra app in 2025 can be a real pain — especially since the ...
🌐
Reddit
reddit.com › r/macos › installed homebrew programs return "zsh: killed"
r/MacOS on Reddit: Installed homebrew programs return "zsh: killed"
May 11, 2022 -

When I type brew, I get the output:

zsh: killed     brew

Writing out the whole path still gives the same output, so it doesn't seem like a path problem.

Furthermore, running /bin/bash gives the output:

zsh: killed     /bin/bash

I changed the names of .zshrc and .zprofile, yet the problem still persisted.

To add on, this problem also occurs with programs like pyenv.

🌐
Reddit
reddit.com › r/linuxquestions › zsh killing my python script
r/linuxquestions on Reddit: zsh killing my python script
April 21, 2020 -

When I run my python program in zsh using python3 Mosesh.py I get the message zsh: killed python3 Mosesh.py after a few seconds. All the program is doing at the moment is creating a list of data to work with but at most that should be about 14kB so being out of ram doesn’t seem to be the issue as most of my googling has suggested. I’ve also noticed the issue persists in other shells such as bash. Any ideas what the issue is or how to fix it? Thanks.

🌐
Image.sc
forum.image.sc › usage & issues
Update ZSH killed during training - Usage & Issues - Image.sc Forum
September 28, 2023 - I posted here a little while ago regarding the ZSH killed issue I’ve been experiencing. I tried erasing the program, environment, really everything associated with DLC and trying again. I’m still running into some issues, at about iteration ~3500 the program returns: zsh: killed python -m deeplabcut I’m provided with this traceback when restarting as well: Traceback (most recent call last): File "/Users/jakeziegler/Desktop/deeplabcut/DeepLabCut/deeplabcut/gui/tabs/train_network.py", lin...
🌐
Cockos Incorporated
forums.cockos.com › showthread.php
[SOLVED] What is this? zsh:killed reaper
November 6, 2022 - It appears JavaScript is not enabled for your browser. If you already have an account on this system, you can log-in directly here: · Otherwise, in order to verify you are not a bot, you will need to temporarily enable JavaScript and reload this page. Thank you for your understanding
🌐
Cockos Incorporated Forums
forum.cockos.com › showthread.php
[SOLVED] What is this? zsh:killed reaper - Cockos Forums
November 6, 2022 - It appears JavaScript is not enabled for your browser. If you already have an account on this system, you can log-in directly here: · Otherwise, in order to verify you are not a bot, you will need to temporarily enable JavaScript and reload this page. Thank you for your understanding
🌐
Manager Forum
forum.manager.io › t › mac-os-server-zsh-killed-managerserver › 51630
Mac os server - zsh killed ./ManagerServer - Manager Forum
February 10, 2024 - Hello all, I’ve installed the arm server version for mac and tried to opened in via terminal, but nothing worked, i also disabled the unverified developers in the setting and using the command: sudo spctl --master-disable after running ./ManagerServer it gives me this zsh: killed ./ManagerServer ...
🌐
GitHub
github.com › tensorflow › tensorboard › issues › 5658
zsh killed on mac m1 · Issue #5658 · tensorflow/tensorboard
April 7, 2022 - I tried to run tensorboard on mac m1 (OS Monterey 12.2.1) and tensorflow macos 2.6.0 in terminal. Is that due to RAM issue? I have 8 GB RAM and running on conda env. It keeps giving me the error: z...
Author   tensorflow