How to add an IP address to loopback interface on Mac

Create file /Library/LaunchDaemons/yourname.plist with the following content:

and reboot the machine.

Share on FacebookTweet about this on TwitterShare on LinkedInShare on Google+Pin on PinterestEmail this to someone
Follow me:


I'm a well seasoned developer, consultant and educator of web applications based mainly on Sencha libraries, PHP, MySQL and Node.js. Besides (Apple) computers, I love photography and mountain biking.
Follow me:

Latest posts by Saki (see all)


  1. says

    Very strange…

    First, netmask for loopback interface usually is
    Second, reboot just to add address sounds very oldfashioned.
    Third, at least under linux, one could use any 127.x.y.z addresses without setting any alias at all. I often use ssh -L 127.x.y.z:2222:10.x.y.z:22 user@gw commands to access boxes behind firewall when VPNs do not work. And I don’t have to setup any aliases. lo0 does the magic.

  2. Andi says

    With the release of Snow Leopard, there is a watcher on /etc/hosts…
    just do your edits there, like under any other *nix, and the changes will get picked up immediately.
    SL will also automatically update other places like /private/etc/hosts afterwards.

  3. says

    adding myhost.local myhost

    to /etc/hosts is not enough as it doesn’t create IP on lo adapter. I’ve tested it right now on SL 10.6.5.

    I should have explained better: The point here is not if mask is “usual or not” neither if I have to reboot or not. Sure I do not need to reboot as it is enough to run command:

    sudo ifconfig lo0 netmask

    The whole point is how to make this change permanent so I do not need to run this command after each reboot. Therefore the reboot in the original post: to verify that everything went right.

  4. says

    I rarely comment, however after browsing a bunch of remarks on How to add an IP address to loopback interface on Mac | Saki’s Blog. I actually do have 2 questions for you if it’s okay.

    Could it be just me or does it look like some of these responses look as if they are coming from brain dead visitors?

    😛 And, if you are posting on additional online social
    sites, I’d like to follow you. Would you make a list of every one of your social networking sites like your twitter feed, Facebook page or linkedin profile?

We will be happy to hear back from you

Please Login to post a comment