How to block X (Twitter) on Mac

Sameed Ahmad
By Sameed Ahmad, who builds Focus AI (so read the Focus AI parts with that in mind).
Updated December 2026

To block X (Twitter) on a Mac, you have three working options: macOS built-in Screen Time (System Settings > Screen Time > Content & Privacy, locked with a 4-digit passcode), editing /etc/hosts in Terminal followed by sudo dscacheutil -flushcache (blocks x.com across Chrome, Safari, and Firefox for free), or installing Focus AI inside Chrome, Arc, Brave, Edge, or Firefox on macOS. Editing /etc/hosts blocks x.com, www.x.com, mobile.x.com, twitter.com, www.twitter.com, mobile.twitter.com, t.co across every desktop browser on your Mac once DNS flushes, though anyone with your Mac login password can reverse it in 30 seconds. Remember that macOS Screen Time web restrictions enforce reliably in Safari while third-party browsers like Chrome need a browser blocker like Focus AI (free for 3 AI focus sessions and up to 3 always-blocked sites).

1. Block X (Twitter) on Mac using Terminal & /etc/hosts (free, all browsers)

  1. Open Terminal on your Mac (Command + Space, type Terminal, press Enter) and run: sudo nano /etc/hosts
  2. Type your Mac administrator password and scroll to the bottom of the file.
  3. Paste the exact 127.0.0.1 and ::1 block lines shown below for X (Twitter).
  4. Press Control + O, hit Enter to save, press Control + X to exit, then flush macOS DNS cache: sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder
  5. Quit (Cmd + Q) and reopen Chrome, Safari, or Firefox so cached connections clear.

2. Block X (Twitter) on Mac with macOS Screen Time (built-in Safari + passcode)

  1. Open System Settings > Screen Time and turn on Screen Time.
  2. Click Lock Screen Time Settings and ask a friend, partner, or parent to enter a 4-digit passcode you do not know.
  3. Open Content & Privacy > Content Restrictions (or App Store, Media, Web, & Games on Sequoia), enable Content & Privacy, and set Web Content to Limit Adult Websites.
  4. Click Customize, click + under Restricted, and add x.com.

3. Block X (Twitter) on Mac Chrome, Brave, Arc, Edge, or Firefox with Focus AI

  1. Install Focus AI in Chrome, Brave, Arc, Edge, or Firefox on your Mac (free for 3 AI focus sessions and up to 3 always-blocked sites).
  2. Enable Allow in Incognito in your browser's extensions page so private windows stay covered.
  3. Lock x.com in Always-On Site Blocker (add Friend/Parent Passcode Lock on Pro) or run context-aware AI focus sessions that keep work tutorials open.

Exact X (Twitter) domains & subdomains (hosts file block)

Because X migrated from twitter.com to x.com while maintaining redirects and t.co link wrappers, half the manual lists online miss one of the domains. Blocking all 7 hostnames (x.com, www.x.com, mobile.x.com, twitter.com, www.twitter.com, mobile.twitter.com, t.co) in IPv4 and IPv6 closes the redirect leak.

127.0.0.1 x.com
::1 x.com
127.0.0.1 www.x.com
::1 www.x.com
127.0.0.1 mobile.x.com
::1 mobile.x.com
127.0.0.1 twitter.com
::1 twitter.com
127.0.0.1 www.twitter.com
::1 www.twitter.com
127.0.0.1 mobile.twitter.com
::1 mobile.twitter.com
127.0.0.1 t.co
::1 t.co
Need multiple sites? Open the free Hosts File Website Blocker Generator →
Interactive Demo · Zero Install

Try Focus AI live against X (Twitter)

Pick or type a real work task, then test any URL to see what stays open and what gets blocked.

x.com

X (Twitter) (social feed) does not serve "Building Next.js app".

BLOCKED
Session check log for “Building Next.js app”
Simulated client-side demo. In Chrome, Focus AI runs live on every tab during active sessions.Add Focus AI to Chrome
Mac loopholes & reality check

What breaks X (Twitter) blocks on Mac

On macOS, two subtle loopholes break X (Twitter) blocks: Safari's iCloud Private Relay silently bypasses /etc/hosts if you subscribe to iCloud+, and macOS Screen Time's Restricted Websites list often ignores Google Chrome and Firefox. Turn off Private Relay (or enforce Screen Time in Safari + Focus AI in Chrome/Firefox) for airtight Mac coverage.

Mac hosts note: include both x.com and legacy twitter.com (plus www and mobile subdomains) in /etc/hosts and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder so redirects cannot leak.

X is the easiest feed for founders, engineers, and knowledge workers to disguise as 'staying informed.' The For You algorithm elevates outrage and hot takes because arguments drive replies, turning a 90-second industry check into 45 minutes of fragmented attention.

Privacy & pricing: Focus AI checks only the URL and brief page snippet during active sessions. Banking, login, email, and form inputs are skipped. Nothing is stored as browsing history or sold. Free for 3 AI focus sessions and up to 3 always-blocked sites, then $4.99/week, $14.99/month, or $79/year (save 56%).
FUTURE YOU IS WATCHINGLOCK IN

Block X (Twitter) on Mac and keep it blocked

Start free with 3 AI focus sessions and up to 3 always-blocked sites. Upgrade anytime for Friend/Parent Passcode Lock and unlimited protection.

Add Focus AI to Chrome
Free for 3 AI focus sessions + 3 always-blocked sites · 30-second setup · No account needed

Frequently asked questions

Why did X (Twitter) still load on my Mac after editing /etc/hosts?

Run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder, fully quit (Cmd+Q) your browser, include ::1 IPv6 lines, and check whether Chrome Secure DNS or Safari iCloud Private Relay is turned on.

Does Mac Screen Time block X (Twitter) in Google Chrome?

Usually not reliably: macOS Screen Time web restrictions primarily govern Safari. To block X (Twitter) inside Chrome, Arc, Brave, or Firefox on a Mac, install Focus AI (and enable Allow in Incognito).

How do I unblock X (Twitter) on Mac later if I used /etc/hosts?

Run sudo nano /etc/hosts in Terminal, delete the x.com lines, save (Control+O, Control+X), and run sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder.

More ways to block X (Twitter) & Mac guides