Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Add static route at startup

Is there an easy way to add a static route each time I reboot my mac?


Cheers


Posted on Nov 9, 2024 10:25 AM

Reply
5 replies

Nov 10, 2024 9:10 AM in response to Noah Wallach

Ah, that will cost extra! ;)


Barney-15E hit the nail on the head. That is you will want to load this script on boot by using a LaunchDaemon.


For example:

  • Start by creating a new LaunchDaemon file in: /Library/LaunchDaemons
  • To do so, enter the following command in the Terminal app: sudo nano /Library/LaunchDaemons/com.custom.staticroute.plist
  • Enter the following into that plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>com.custom.staticroute</string>
    <key>ProgramArguments</key>
    <array>
      <string>/etc/rc.local</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>
  • Save, and then, load the LaunchDaemon with the following command in the Terminal app: sudo launchctl load /Library/LaunchDaemons/com.custom.staticroute.plist

Add static route at startup

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.