MAMP PRO and the /private/etc/hosts file

Discussion in 'Mac Programming' started by marcosdipaolo, Jan 3, 2018.

  1. marcosdipaolo, Jan 3, 2018
    Last edited: Jan 3, 2018

    marcosdipaolo macrumors newbie

    marcosdipaolo

    Joined:
    Apr 2, 2013
    #1
    It turns out that today i started trying MAMP PRO for Postfix SMTP.
    But i had and have a nasty problem.
    There's no way MAMP PRO 4.2.1 is allowed to overwrite the hosts file, and it needs to, so MAMP PRO doesn't work.
    I found no clear answer in the internet and i tried already couple of solutions with no success, like recreating the file, erasing or commenting the 127.0.0.1 localhost line, among others.
    Any ideas around?
    [​IMG]
     
  2. techwarrior macrumors 6502a

    techwarrior

    Joined:
    Jul 30, 2009
    Location:
    Colorado
    #2
    The /etc directory (actually a link to /private/etc/) and hosts are owned by root and so you need to use sudo commands to edit it, inheriting root permissions for the file. It may also be protected by SIP (aka "rootless") in newer Macs.

    Try editing it manually using sudo vi etc/hosts. If the installer isn't configured to use sudo for the command (which would prompt for our administrative account password), it would stand to reason this would cause the issue.
     
  3. IHelpId10t5 macrumors 6502

    Joined:
    Nov 28, 2014
    #3
    I am running MAMP Pro 3.5.2 (have not upgraded to latest yet) and it has never had a problem allowing it to use the hosts file on my Mac. I can launch the app, but then when I click the "Start" button to start servers it prompts to "Authorize to allow MAMP PRO to perform tasks that need admin rights. Type your password to allow this". This prompt is obviously what allows the application to modify etc/hosts. My hosts has the following ownership and permissions:

    -rw-r--r-- 1 root wheel 255B Jan 3 23:17 hosts

    Sounds like they may have a problem with the 4.x versions of MAMP Pro? I'll be following this discussion and am now glad that I've been lazy and not upgraded yet.
     

Share This Page