nself dns-setup
nself dns-setup
Section titled “nself dns-setup”Add project domains to /etc/hosts (run with sudo).
Synopsis
Section titled “Synopsis”nself dns-setup [flags]Description
Section titled “Description”nself dns-setup reads the current project’s .env, collects every domain that ɳSelf generates nginx config for, and appends missing entries to /etc/hosts so local *.<custom-domain> URLs resolve to 127.0.0.1. Because writing /etc/hosts requires root, run the command once with sudo.
Wildcard subdomains (e.g. *.pro.ummat.local) cannot live in /etc/hosts. The command prints the wildcard entries separately so you can configure dnsmasq with lines like address=/.pro.ummat.local/127.0.0.1. For a fully wildcard-friendly local trust setup, see nself trust.
This command is only needed when you use a custom BASE_DOMAIN (for example ummat.local). Standard nself and localhost setups do not need it. On macOS, if run without sudo, the command attempts to relaunch itself via osascript to surface a native admin password prompt.
| Flag | Default | Description |
|---|---|---|
--dry-run, -n | false | Print entries that would be added without writing |
--project, -p | "" | Path to nself project directory (useful when running with sudo) |
--help, -h | none | Show help |
Examples
Section titled “Examples”# Preview entries without touching /etc/hostsnself dns-setup --dry-run
# Apply entries (writes /etc/hosts, requires sudo)sudo nself dns-setup
# Run with sudo from a path other than the project rootsudo nself dns-setup --project /Users/me/projects/myapp
# After running, see whether all domains resolvenself urls