FG
💻 Software

Mac OS X "hosts" file, can I include other files with it?

Fresh7 days ago
Mar 15, 20265048 views
Confidence Score0%
0%

Problem

I am working on some automation scripts to configure my network settings, hosts file contents, and /etc/resolver files, when accessing different networks I frequent between. There are some combinations that can occur that all require changes to the hosts file, and I'd like to avoid having to set up…

Error Output

#!include home.hosts
#!include work.hosts

127.0.0.1 localhost
::1 localhost

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: Mac OS X "hosts" file, can I include other files with it?

Low Risk

I am not aware of any include possibility. What I'd do, however, is to make sections in my hosts file, and then use a script to comment the lines in each section using, e.g., sed. This way your file would look like Edit: Adding in a quick attempt to…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment