Skip to content

Instantly share code, notes, and snippets.

@qzi
Last active March 2, 2024 16:18
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save qzi/b0cc89698d0d7a3affcc4c9d9f3c9b06 to your computer and use it in GitHub Desktop.
Save qzi/b0cc89698d0d7a3affcc4c9d9f3c9b06 to your computer and use it in GitHub Desktop.
sysctl.conf.sh for macos
#!/bin/bash
# Desc: network performance tunning for mac gateway and it should run using sudo
# increase the socket buffer
sysctl -w kern.ipc.maxsockbuf=16777216
# net.inet.tcp.sendspace + net.inet.tcp.recvspace < kern.ipc.maxsockbuf
sysctl -w net.inet.tcp.sendspace=1048576
sysctl -w net.inet.tcp.recvspace=1048576
sysctl -w net.inet.tcp.win_scale_factor=8
sysctl -w net.inet.tcp.autorcvbufmax=33554432
sysctl -w net.inet.tcp.autosndbufmax=33554432
# udp max ram
sysctl -w net.inet.udp.maxdgram=65500
# increase the max num of socket connection
sysctl -w kern.ipc.somaxconn=2048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment