How to solve zsh: killed on MacOS Ventura

Sebastían Pulido
3 min readFeb 1, 2023

In this guide - You will find the final solution to this problem

Honestly, I have searched all over the web for a solution. What I found, for the most part, is either out of date or on specific topics that are not useful for everyone.

Issue

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.

Another option is that perhaps you are one of those who likes to mess around and configure files without having full knowledge of the commands you launch on the console.

Whatever the case

zsh: killed | bash: killed 9 | SIGKILL

The problem is that you won’t be able to execute many of the basic UNIX commands. This complicates things when developing further because you won’t be able to open the built-in terminal in your code editor.

Solution

Open the /opt/local/etc/macports folder. You can simply write in the terminal

open /opt/local/etc/macports

Once inside the folder. Open the macports.conf file

You can double click on it and browse for an App to open it or just drag and drop it into your preferred code editor.

In the first 20 lines of this file you will find the following…

macports.conf

The important thing is after the whitespaces followed by binpath. Copy that path to use later.

Now we have to open .zshrc and .zprofile to add the path that we copied. You can type open .zshrc and open .zprofile from the terminal or use nano, vi, or whatever works best for you.

Within each of these files we have to add a new line with the text

export PATH="/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin"

IMPORTANT after PATH= always use double quotes to enclose the text. If the value obtained is not the same as in this guide, use the value obtained in macports.conf

#if you have something like this in your .zshrc
export PATH="$HOME/bin:/usr/local/bin:$PATH"

# just comment out that line by adding a # at the beginning
# export PATH="$HOME/bin:/usr/local/bin:$PATH"
# if you have this message

# MacPorts Installer addition on 2022-07-12_at_22:37:02: adding an appropriate $
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

# just comment the line with the export part

# MacPorts Installer addition on 2022-07-12_at_22:37:02: adding an appropriate $
# export PATH=/opt/local/bin:/opt/local/sbin:$PATH
# Finished adapting your PATH environment variable for use with MacPorts.

Save the changes, open a new terminal and test that everything works fine

I hope it has been helpful. You can leave your like or contact me on Twitter.

--

--