I want to run sudo ifconfig lo0 alias someIp every time I open my mac, what would be the best way to achieve this?


1 Answer 1


You can create a LauchDaemon. LaunchDaemons are processes managed by the launchd service in macOS that are loaded when the system boots. LaunchDaemons can be used to run a program one-time, contiuously or periodically after boot.

Create a file called org.my.ifconfig.plist in /Library/LaunchDaemons/ with the following content and you should be good to go.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

Make sure the file is owned by root and in the group wheel, and has the permissions 644: Owner – read/write, group – read, everyone – read

More information can be found at developer.apple.com at Creating Launch Daemons and Agents.

  • 1
    Mind the typo: <interger>10</integer> -> <integer>10</integer> Aug 21, 2019 at 12:51

Not the answer you're looking for? Browse other questions tagged .