How do I disconnect from an existing Truffle Develop session

MacOS Catalina 10.15.2 (19C57)
Truffle v5.0.40 (core: 5.0.40)
Node v12.12.0

When I start a “Truffle Develop” session, and exit the session, and start another session, the message, “Connected to existing Truffle Develop session at http://127.0.0.1:9545/” displays.

As convenient as this is, I’m unable to view the mnemonic and/or private keys.

If I restart, the session is ended, however, I’d like to know if there is a way to kill the existing session without restarting and establishing a new one.

That means you are already running ganache on port 9545 somewhere on your system.
Sometime it can be because of a “rogue” ganache process that didn’t shut down properly after you exited another Truffle session.

2 solutions:

  • If you know where is the other truffle console session, stop it with ctrl c
  • otherwise, you can kill the ganache process manually with lsof -i tcp:9545 to find its pid (process number) and then kill it with kill -9 {replace_by_pid}
1 Like