'Heroku CLI not working after update to macOS Monterey 12.2
I updated my macOS from Catalina to Monterey 12.2 a few days ago, and am no longer able to access Heroku from the command line (using zsh). Normally, running heroku login
from the terminal will open Heroku in a web browser, and after logging in, I am able to run subsequent Heroku commands from the CLI.
Here's the input and error message I get:
% heroku login
fatal error: runtime: bsdthread_register error
runtime stack:
runtime.throw(0x2d5619, 0x21)
/usr/local/go/src/runtime/panic.go:566 +0x95 fp=0x7ff7bfeff6d0 sp=0x7ff7bfeff6b0
runtime.goenvs()
/usr/local/go/src/runtime/os_darwin.go:88 +0xa0 fp=0x7ff7bfeff700 sp=0x7ff7bfeff6d0
runtime.schedinit()
/usr/local/go/src/runtime/proc.go:450 +0x9c fp=0x7ff7bfeff740 sp=0x7ff7bfeff700
runtime.rt0_go(0x7ff7bfeff778, 0x2, 0x7ff7bfeff778, 0x0, 0x1000, 0x2, 0x7ff7bfeff948, 0x7ff7bfeff978, 0x0, 0x7ff7bfeff97e, ...)
/usr/local/go/src/runtime/asm_amd64.s:145 +0x14f fp=0x7ff7bfeff748 sp=0x7ff7bfeff740
On first search of this error online, it seemed like maybe I needed to update Go, so I downloaded the latest version, and added it to my path like so:
% mkdir $HOME/go
% cd $HOME/go
% mkdir bin pkg src
and added the following lines to my .zshrc file:
export GOPATH=$HOME/go
PATH=$PATH:$GOPATH/bin
(I then ran source .zshrc
from the home directory).
This appeared to successfully update Go, because go version
returns go1.17.6 darwin/amd64
.
I ran heroku login
again and got the exact same error. The same error occurs for any heroku command. Any clues on what might be going wrong?
Solution 1:[1]
I solved the issue, though I'm still unclear on why that particular error message was showing up. Here's what I did:
I thought I might find answers in Heroku error logs on my computer. I couldn't use the heroku logs
command, but I could search manually. Heroku's website says that these are located here ~/Library/Caches/heroku/error.log
on macOS. But this directory didn't exist. There was no heroku
folder in ~/Library/Caches/
. I still had Heroku - which heroku
correctly returned the path /usr/local/bin/heroku
.
At this point I wondered whether the CleanMyMac X
software I had used to clear storage space before updating my OS might have deleted the Heroku folder along with old error logs, and this might have prevented the program from opening?
Solution: I uninstalled the Heroku CLI based on instructions from Heroku's website:
% brew uninstall heroku
% rm -rf ~/.local/share/heroku ~/Library/Caches/heroku
and then re-installed with brew tap heroku/brew && brew install heroku
The installation failed, and homebrew prompted me to update some of the Command Line Tools:
% softwareupdate --all --install --force
% sudo rm -rf /Library/Developer/CommandLineTools
% sudo xcode-select --install
After these updates, I tried again, and the heroku install succeeded. I have since been able to use Heroku commands using the CLI without problems.
Solution 2:[2]
Following the troubleshooting tips on the Heroku website I checked which binary heroku
was pointing to, and it turned out to be an old installation outside of Homebrew:
$ which heroku
/usr/local/heroku/bin/heroku # should be: /usr/local/bin/heroku
I deleted this installation, and then restarted the Terminal for heroku
installed via Homebrew to be used:
$ rm -rf /usr/local/heroku
Solution 3:[3]
For me heroku CLI was pointing to the wrong place, so simply running brew link --overwrite heroku
solved it. I'd follow the recommendation written by Heroku about Brew issues
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Manon Ironside |
Solution 2 | Frederik |
Solution 3 | Asaf David |