Reputation: 180
I'm trying to set up git on my apple M1 macbook air. I tried to run git and I saw that I needed to update my command-line-tools first and so did I. But now, every time I tried to enter a git command, I see the same line again and again: zsh: killed git
.
For example, when I type git
the terminal tells me: zsh: killed git
, when I type git --version
the terminal tells me: zsh: killed git --version
and so on. Does someone knows where the problem comes from and how to solve it?
Thanks for reading and trying to find an answer.
Upvotes: 15
Views: 67300
Reputation: 573
MacBook Pro M1, had the same problem with kubectl
- plain reboot helped.
Will have in mind the brew reinstall path though next time it happens.
Upvotes: 0
Reputation: 77
I was having a similar issue with a binary I was building locally. In my case I was getting an error zsh: killed MY_BINARY
.
I tried all the suggestions I've seen such as messing with my ~/.z*
files, changing my go versions, cleaning up my $PATH, but eventually I found out that my MacBook had an invalid code signature for that binary. I believe an update might have messed this up for me.
Anyway, I just had to run:
codesign --sign - --force PATH_TO_YOUR_ISSUE_BINARY
and it said replacing existing signature
and then everything has worked fine since then.
(use which YOUR_COMMAND
to find the path for the above command)
Upvotes: 0
Reputation: 11
I solved it now just by using codesign --force --deep --sign - binaryname
Upvotes: 1
Reputation: 1
I recently encountered this with running compiled go executables, after running go build main.go
the main executable would be generated but zsh would kill it and rm the file when trying to run ./main.go
Running brew reinstall go
fixed it.
Upvotes: 0
Reputation: 17596
I was getting this error after installing rbenv and changing the ruby version I was using. Whenever I'd run bundle exec fastlane , zsh would immediately kill the process.
I fixed it by deleting the Gemfile.lock file and then running bundle install
.
Upvotes: 1
Reputation: 12656
Before you reinstall anything, try re-cloning the repo.
I had this problem in only one repo and none of the other solutions here worked but re-cloning it fixed it for me.
Upvotes: -1
Reputation: 2326
brew reinstall $(brew deps git) git
or if it happens to some other software than git, replace with whatever is affected:
brew reinstall $(brew deps ffmpeg) ffmpeg
It seems to occur after some important macOS update (it happened to me after the 12.2.1 update on Monterey). Some dependency was broken in the process.
Reinstalling only git
is not enough. Reinstalling a specific dependency (gettext
or pcre2
) might work; all of them will. But if this happens to you with some other software, it might have many more deps: e.g., ffmpeg
has 96. Automatically reinstalling all dependencies before reinstalling the sofware itself is the solution.
No need for the nuclear option of removing Homebrew and all its packages.
Upvotes: 2
Reputation: 131
I have an M1 with macOS Big Sur so I had to install the dev tools xcode-select
first because reinstalling gettext
or pcre2
wasn't running either.
Did it in this order:
xcode-select --install
brew reinstall gettext
brew reinstall pcre2
brew reinstall git
Sheeeeesh!
Upvotes: 2
Reputation: 21
I faced the same issue, I have a MacBook Pro M1 and I run the next commands:
brew reinstall gettex
brew reinstall pcre2
brew reinstall git
Upvotes: 0
Reputation: 3683
To find out the cause of the crash, you can open Console
with ⌘
+ spacebar
, then go to "Crash Reports".
If you scroll down a bit, you will find the source of the error:
Application Specific Information:
dyld: launch, loading dependent libraries
/opt/homebrew/opt/gettext/lib/libintl.8.dylib
So in this example, a simple brew reinstall gettext
will fix the issue (unless there is also an issue in another dependency of course).
To fix all dependencies issues in a single step, you could also simply do brew reinstall $(brew deps git)
.
Upvotes: 4
Reputation: 71
I used the below commands:
brew uninstall git
brew update
brew reinstall pcre2 gettext
brew install git
Git worked after.
Upvotes: 7
Reputation: 1249
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.
Upvotes: 19