Software⏱️ 4 min read📅 2026-06-11

How to Fix: packet_write_wait: Broken Pipe error on MacOS Sierra SSH

Fix packet_write_wait: Broken Pipe error on MacOS Sierra SSH with ServerAliveInterval and TCPKeepAlive settings.

Quick Answer: Adjust ServerAliveInterval and TCPKeepAlive settings to prevent disconnections.

The packet_write_wait: Broken Pipe error on MacOS Sierra SSH connections occurs when the SSH connection is idle for an extended period, causing the server to close the connection. This issue affects users who regularly connect to their EC2 instances using SSH and experience disconnections due to inactivity.

This problem can be frustrating as it disrupts productivity and makes it difficult to manage remote servers. In this guide, we will walk you through the steps to resolve this issue and prevent packet_write_wait: Broken Pipe errors on MacOS Sierra SSH connections.

🔍 Why This Happens

  • The primary reason for the packet_write_wait: Broken Pipe error is due to the default timeout settings in SSH. When the connection is idle, the server sends a 'no data' message after a certain period, which can be misinterpreted as a broken pipe by the client. This can happen if the server or client is not configured to send periodic messages to maintain the connection.
  • Another possible cause of this error is related to the TCPKeepAlive setting. If this setting is set to 'no', the server will not send periodic messages to maintain the connection, which can lead to the packet_write_wait: Broken Pipe error.

✅ Best Solutions to Fix It

Configuring ServerAliveInterval and ClientAliveInterval

  1. Step 1: Open the SSH configuration file in a text editor using the command `sudo nano /etc/ssh/sshd_config`. Add or modify the following lines to set the ServerAliveInterval and ClientAliveInterval settings: `ServerAliveInterval 5` and `ClientAliveInterval 120`. Save and close the file.
  2. Step 2: Restart the SSH service to apply the changes: `sudo systemctl restart sshd`. This will ensure that the new settings are applied to all existing connections.
  3. Step 3: Verify that the changes have taken effect by connecting to your EC2 instance using SSH. You should see periodic messages indicating that the server is alive and responding to client requests.

Configuring TCPKeepAlive

  1. Step 1: Open the SSH configuration file in a text editor using the command `sudo nano /etc/ssh/sshd_config`. Add or modify the following line to set the TCPKeepAlive setting: `TCPKeepAlive yes`. Save and close the file.
  2. Step 2: Restart the SSH service to apply the changes: `sudo systemctl restart sshd`. This will ensure that the new settings are applied to all existing connections.
  3. Step 3: Verify that the changes have taken effect by connecting to your EC2 instance using SSH. You should see periodic messages indicating that the server is alive and responding to client requests.

✨ Wrapping Up

To resolve the packet_write_wait: Broken Pipe error on MacOS Sierra SSH connections, you can try configuring ServerAliveInterval and ClientAliveInterval settings or setting TCPKeepAlive to yes. By implementing these changes, you can prevent disconnections due to inactivity and ensure a stable SSH connection to your EC2 instance.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions