I faced this same issue in the M1 Macbook pro and fixed it by doing the following

Open ~/.zshrc file (Create a new one if not present already) Add the following line

alias python3="/usr/bin/python3"

Make sure you are able to access python3 from the above location by running

/usr/bin/python3

This should invoke Python3 for you or check for the correct path in /usr/bin and update the above line accordingly. You can do the same for other versions of Python also accordingly.

Answer from Manu mathew on Stack Overflow
🌐
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.

🌐
Apple Community
discussions.apple.com › thread › 254356633
zsh: killed ---> new mac need help - Apple Community
November 7, 2022 - if you invoke python3.11, does that work? That would usually be a missing alias, or missing link. As for ‘solved”, I have no means to mark a posting answered. Only the original poster can mark a post as solved, and—per Apple—it cannot be undone once marked. ... This has nothing to do with zsh. The Python process is getting killed automatically.
🌐
Stack Overflow
stackoverflow.com › questions › 72085413 › zsh-killed-python3-model-py
python - zsh: killed python3 model.py - Stack Overflow
zsh: no such file or directory: #!/usr/bin/env python3 · 2 · zsh: command not found: import · 1 · zsh & python. trying to use python script in zsh prompt, however, cannot · 0 · zsh: commands not working for pip, conda, python · 2 · zsh: abort python error when I try to run the app in venv · 17 · zsh: killed python3 on M1 MacBook Pro ·
🌐
Reddit
reddit.com › r/linuxquestions › zsh: killed python3 model.py
r/linuxquestions on Reddit: zsh: killed python3 model.py
May 2, 2022 -

dmesg printed 'Unable to obtain kernel buffer: Operation not permitted'.

Trying to run a k-NN model on unseen data and getting this error, code runs fine with a smaller sample just when it came to the entire dataset it got this error.

🌐
Stack Overflow
stackoverflow.com › questions › 72638379 › zsh-killed-python3-on-m1-pro-macbook-pro
python - zsh: killed python3 on M1 Pro MacBook Pro - Stack Overflow
hello I've ran into a problem with running python3 on M1 MacBook pro. I deleted a version of python, after that I checked what version I was running and I get "zsh: killed python3". p...
🌐
GitHub
github.com › pypa › pipenv › issues › 4715
zsh killed python · Issue #4715 · pypa/pipenv
June 7, 2021 - I downgraded the python3 version on my macOS and tried both ways of installing the python. One through the terminal and another of manual installation. After that, when I check the python3 version it says "zsh : killed python3 --version"...
Author   pypa
🌐
GitHub
github.com › pypa › pipenv › issues › 4502
'zsh: killed python' while executing from virtualenv on macOS Big Sur for Python 2.7 · Issue #4502 · pypa/pipenv
October 27, 2020 - zsh: killed python while executing from virtualenv on macOS Big Sur (platform: arm64) for Python 2.7 It is working fine for Python 3.8 Expected result Python Shell should launch from virtual env shell. On using pipenv sync should install...
Author   pypa
Find elsewhere
🌐
Glarity
askai.glarity.app › search › Why-does-my-Python-script-get-killed-when-running-in-zsh-on-my-Mac
Why does my Python script get killed when running in zsh on my Mac? - Ask and Answer - Glarity
When you encounter the message `zsh: killed python3` while running a Python script in zsh on your Mac, it typically indicates that the operating system has terminated the Python process.
🌐
Apple Developer
developer.apple.com › forums › thread › 734345
Python script get killed only when… | Apple Developer Forums
It seems like the system is killing the process when it starts using a certain threshold of resources. I am on a brand new M2 MacBook Pro with 16gb of ram. I've tried restarting my computer and I've reinstalled python from several different sources, all to no avail. When it crashed, the shell says nothing more than "zsh: killed".
🌐
Image.sc
forum.image.sc › usage & issues
ZSH killed during training - Usage & Issues - Image.sc Forum
September 12, 2023 - Every time I try training, my console returns zsh: killed python -m deeplabcut What can I do to fix this? Should I just uninstall and reinstall?
🌐
GitHub
github.com › microsoft › vscode › issues › 192460
zsh: killed · Issue #192460 · microsoft/vscode
September 7, 2023 - Type: Bug I have this problem in my terminal on my Mac and in the terminal on Visual studio Code. When I type python3 and python3 -version it gives me zsh: killed. Im new to coding and it didnt do this before im not sure how to fix it. V...
Author   microsoft
🌐
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...
🌐
GitHub
github.com › jupyter › notebook › issues › 6007
Jupyter notebook gets killed by zsh on Apple M1 · Issue #6007 · jupyter/notebook
March 15, 2021 - Describe the bug When I run jupyter notebook zsh kills it on Apple M1. This is the native version of notebook. It does run correctly under Rosetta2 on the same machine. I had successfully installed and run it in natively on M1 with the earlier versions of the code / OS. I am using homebrew installed python3 (all versions described below). Installs work fine, both for pip3 install notebook and using
Author   jupyter
🌐
Apple Developer
developer.apple.com › forums › thread › 809830
Zsh kills Python process with plen… | Apple Developer Forums
December 11, 2025 - This folder has about 470 GB of available space at the start of the process (I can see this through get info) however, once about 40 or so swapfiles are created, for a total of about 40GB of virtual memory occupied (and thus still plenty of available space in VM), zsh kills the python process responsible for the RAM usage (notably, it does not kill another python process using only about 100 MB of RAM).
🌐
GitHub
github.com › cvxpy › cvxpy › issues › 1360
zsh: killed python my_test_script.py (kernel dies) · Issue #1360 · cvxpy/cvxpy
May 3, 2021 - I'm not sure whether this is a bug or simply a limitation of my laptop, but in any case I would like to know the answer. When I'm running a simple minimization problem with medium/large datasets, the process seems to get killed somewhere...
Author   cvxpy
🌐
Apple Community
discussions.apple.com › thread › 256204863
Zsh kills Python process with plenty of a… - Apple Community
December 10, 2025 - This folder has about 470 GB of available space at the start of the process (I can see this through get info) however, once about 40 or so swapfiles are created, for a total of about 40GB of virtual memory occupied (and thus still plenty of available space in VM), zsh kills the python process responsible for the RAM usage (notably, it does not kill another python process using only about 100 MB of RAM).