Menu

Mac OSX Tuning

January 14, 2025

Guidance for macOS Network Tuning

This page provides tuning recommendations for macOS hosts connected at speeds of 1Gbps or higher. These settings are designed to enhance network performance for high-speed connections. Do not apply these settings on laptops primarily using Wi-Fi connections or on systems connected at speeds of 100 Mbps or lower, as they may degrade performance.

Self-Tuning TCP in Modern macOS Versions

Starting with macOS 10.5, Apple implemented "self-tuning TCP," which dynamically adjusts certain parameters to optimize performance. While defaults have improved over time, adjustments are still necessary to fully utilize high-speed connections.

Default Settings in Recent macOS Versions

Recent macOS versions come with the following defaults (values may vary slightly depending on the exact version):

  • net.inet.tcp.win_scale_factor: 3
  • net.inet.tcp.autorcvbufmax: 4MB 
  • net.inet.tcp.autosndbufmax: 4MB

Suggested Settings for High-Speed Connections

To optimize performance on 1Gbps or faster networks, increase the TCP window scaling factor and autotuning buffer maximums. Add the following settings to the /etc/sysctl.conf file (or apply them dynamically using sysctl commands):

# Increase TCP window scaling factor (default is 3-6; increase to 8)
net.inet.tcp.win_scale_factor=8

# Increase maximum receive buffer for TCP autotuning to 32MB
net.inet.tcp.autorcvbufmax=33554432

# Increase maximum send buffer for TCP autotuning to 32MB
net.inet.tcp.autosndbufmax=33554432
    

Applying the Changes

  1. Create or edit the sysctl configuration file:
    sudo nano /etc/sysctl.conf
    Add the settings above to the file.
  2. Apply changes immediately (without rebooting):
    sudo sysctl -w net.inet.tcp.win_scale_factor=8
    sudo sysctl -w net.inet.tcp.autorcvbufmax=33554432
    sudo sysctl -w net.inet.tcp.autosndbufmax=33554432
                
  3. Make the changes persistent: Ensure /etc/sysctl.conf is loaded at boot by creating a LaunchDaemon or using a boot script if the file isn't loaded automatically in modern macOS versions.
  4. Verify the settings: Use the following command to check the current values:
    sysctl net.inet.tcp

Notes for macOS Ventura and Later

macOS Ventura and later versions use System Integrity Protection (SIP) to restrict changes to system files. If /etc/sysctl.conf is not recognized, consider applying settings dynamically via scripts or using alternative methods like creating a plist in /Library/LaunchDaemons.

Additional Considerations

  • These settings are ideal for high-performance use cases, such as file servers, high-throughput applications, or research environments.
  • Revert settings if they cause instability or reduced performance for your specific use case.