Editing the /etc/sysctl.conf file
apple Verified ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I want to change this variables and make them permanent across reboots:
sysctl -w net.inet.tcp.sendspace=4000000
sysctl -w net.inet.tcp.recvspace=4000000
How do I edit the /etc/sysctl.conf file?
11 replies
Sign in or join Beachball Help to reply.
- 0
nobody loopback ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I dont think, there is a sysctl.conf file in OSX.
What works, is to make a startupscript in /Library/StartupItems.
There you can make the needed adjustments to the values. The Script will be executed at every start of the system. - 0
Community User ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Just use a plaintext editor like vi, emacs or pico (pico's probably the easiest to figure out) and put variable=value, one per line like:
net.inet.tcp.sendspace=4000000
net.inet.tcp.recvspace=4000000CAUTION: make SURE that those values work OK before putting them in this file, otherwise the machine may not boot!
Roger
- 0
George Johnson ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
What is sysctl and what does it do?
- 0
Miguel Santa ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I have a few questions about writing the file using pico:
I open pico write the variables, then what name should I give it, what format should I save it and where is this file going to be saved? I think is a great idea! - 0
Jeff Hubbach ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Open up Terminal and type
man sysctl
It lets you read and set kernel parameters that alter kernel behavior and settings.
- 0
nobody loopback ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
You get an Idea of how the structure of a startup script is made by looking into:
/System/Library/StartupItemscopy one of the simpler script from there to /Library/StartupItems and edit the names of the directories and files and the content.
Here is documentation availible:
http://developer.apple.com/cgi-bin/search.pl?q=StartupItems&site=default_collect ion - 0
macmartin ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I dont think, there is a sysctl.conf file in OSX.
What works, is to make a startupscript in /Library/StartupItems.hello nobody,
I don't think that a StartupItem is necessary.
take a look at /etc/rc around line 50-60:51 if [ -f /etc/sysctl-macosxserver.conf ]; then
52 awk '{ if (!index($1, "#") && index($1, "=")) print $1 }' < /etc/sysctl-macosx server.conf | while read
53 do
54 sysctl -w ${REPLY}
55 done
56 fi
57 if [ -f /etc/sysctl.conf ]; then
58 awk '{ if (!index($1, "#") && index($1, "=")) print $1 }' < /etc/sysctl.conf | while read
59 do
60 sysctl -w ${REPLY}
61 done
62 fi
Best regards
Martin - 0
George Johnson ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Yes, thanks. I had read the man page before I asked the question.
- 0
nobody loopback ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
Macmartin:
You are right !
Thanks for this information.A startup script or a launchd item might have the advantage of beeing more compatible. It now happend several times, an OS upgrade did overwrite things like /etc/hosts, /etc/mail ...
- 0
Bob Sutherby ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
I have been using TextEdit to edit the sysctl.conf, and it works fine.
Mind you, I am still in the process of working out the TCP parameters, and by no means am I an expert. Having said that, here is what works for me so far:
net.inet.tcp.delayed_ack=1
kern.ipc.maxsockbuf=2097152
kern.maxvnodes=17408
net.inet.ip.portrange.first=40000
net.inet.ip.portrange.hifirst=45000
net.inet.ip.portrange.hilast=65532
net.inet.ip.portrange.lowfirst=1022
net.inet.ip.portrange.lowlast=400
net.inet.tcp.recvspace=1048756
net.inet.tcp.sendspace=1048576
net.inet.tcp.rfc1323=0
net.inet.udp.maxdgram=57344
net.inet.udp.recvspace=84160
net.local.stream.recvspace=16000
net.local.stream.sendspace=16000One of my help sources was http://www.speedguide.net
I also used http://www.speakeasy.net/speedtest/ to help check the connection as I tweaked the settings.
Some of the values seem ridiculously high, but they appear to work!
To make your sysctl file (if it isn't already there):
- paste the above settings into a plain text file
- save a copy to your account. Then (with admin access):
- place it in the invisible /private/etc folder which
resides in the HD's root directoryI hope this helps!
- 0
Bob Sutherby ·
Imported from the Apple Support Forums via the Wayback Machine 🔗
If you are going to have these settings:
net.inet.tcp.sendspace=4000000
net.inet.tcp.recvspace=4000000You need to set your kern.ipc.maxsockbuf=8000000 because it needs to be at least the sum of send and rcv values.
If you don't, the network will not initiate and the Mac will hang during bootup... you don't want that, trust me!