# Hosts & Environment: Edit Mac Hosts File

> Edit /etc/hosts and environment variables without Terminal.

- Canonical URL: https://getedith.pro/extensions/hosts-editor
- Category: [Developer & Data](https://getedith.pro/extensions/category/developer-tools)
- Extension ID: `hostsEditor`
- Updated: 2026-12-01
- Part of: [Edith](https://getedith.pro/), a Mac app for macOS 14 or later on Apple silicon, [$35 once for one Mac, plus $7 for each additional Mac](https://getedith.pro/pricing)

Hosts & Environment edits /etc/hosts as entries, groups and named profiles. Every write shows the exact diff, keeps a backup and asks for an administrator. It also shows the variables your shell and apps get, and keeps yours in one marked block of the shell startup file.

## Overview

Hosts & Environment edits /etc/hosts as entries, groups and named profiles. Every write shows the exact diff, keeps a backup and asks for an administrator. It also shows the variables your shell and apps get, and keeps yours in one marked block of the shell startup file.

## How it works

1. **Review the hosts file**: Entries are grouped as the file groups them. Turn one off to comment it out, or add and edit entries with checked addresses and host names.
2. **Switch a profile**: A profile is a named set of entries, such as Staging. Turning it on adds its block to the hosts file; turning it off comments the block out.
3. **Write with a diff**: Edith shows the exact change, keeps a backup of the previous file, asks for an administrator, then clears the DNS cache.
4. **Set environment variables**: Variables you add go into one block marked as Edith's in your shell startup file. Lines outside it are never changed.

## What you can do

- **Edit the hosts file**: Turn /etc/hosts entries on and off, and add, edit and delete them with validation.
- **Hosts profiles**: Switch named sets of hosts entries, such as Staging or Block distractions.
- **Environment variables**: See login shell and app variables and keep your own in a marked block of the shell startup file.

## Command line and MCP

```sh
ed invoke hostsEditor list --json '{}'
ed invoke hostsEditor toggle --json '{"host":"api.staging.test"}'
ed invoke hostsEditor toggle --json '{"host":"api.staging.test","write":true}'
ed invoke hostsEditor apply --json '{"profile":"Staging","write":true}'
```

## Requirements

- macOS 14 or later on Apple silicon

## Use cases

- [Replace Several Paid Developer Tools on a Mac](https://getedith.pro/use-cases/replace-paid-developer-utilities): Cover an SSH manager, a database GUI, an HTTP client, a port killer and a hosts editor on your Mac with one Edith license, and see what each tool costs.

## Get Edith

Edith is a native Mac app for macOS 14 or later on Apple silicon with 100+ extensions, the `ed` command line and an MCP server. $35 once for one Mac, plus $7 for each additional Mac, with no subscription and a 30-day refund.

- [Buy Edith](https://getedith.pro/pricing): $35 once for one Mac, plus $7 for each additional Mac
- [Download Edith](https://getedith.pro/download): the installer, or Homebrew
