When I wake my machine in the morning, it often stays blank because there's some conflict between my 4k monitor and the 'Your computer name has changed for the 3950th time' dialogue that means both screens are off until I dismiss the dialogue I can't see.

I don't want to have to turn wifi on and off manually - we have computers to do things automatically for us - and I need a wired connection while I'm at my desk.

So can I tell the Mac only to enable to wifi if eth0 is inactive?

Or turn the 'Your computer name has changed' dialogue into a notification that doesn't need manual dismissal, because I really don't care what number Apple has decided to add to it today?

  • 8
    Simply change the service priority of the interfaces by moving the Ethernet interface to the top in System Prefs > Network > Gear at the bottom > Set service order...
    – klanomath
    Mar 30, 2017 at 8:00
  • @klanomath Good suggestion. But work said it was time to refresh my laptop and I opted to switch to Linux instead. Much easier than fighting Apple every step of the way. Mar 26, 2019 at 9:46
  • See as well apple.stackexchange.com/questions/98815/…
    – Wollmich
    Feb 15, 2021 at 9:18

3 Answers 3


You have several solutions:

  1. https://gist.github.com/albertbori/1798d88a93175b9da00b

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

  1. https://macperformanceguide.com/blog/2014/20141118_0958-OSX_Yosemite-disable-WIFI.html

  2. The associated google search :


  • 4
    Right now this stackoverflow post is the top Google result for "mac disable wifi on ethernet". This makes your solution #3 moot...
    – Chris
    May 22, 2020 at 2:22
  • 1
    LOL Any google search-based solution is self-evidently moot, especially when it's google.fr (or any other localized search for that matter).
    – Brunox13
    Sep 2, 2020 at 15:43

I realise this question is a bit old... however, as there are multiple ways of accomplishing the same result, I thought it worth sharing one more: using Hammerspoon and a couple of snippets of Lua code.

Hammerspoon is a tool to automate various operations on a Mac. I'm not associated to it in any way, I literally installed it to try and achieve the same purpose as the OP.

For anything you want to automate, you write little Lua scripts; in this case, I created a network.lua file which I saved next to the main configuration file, $HOME/.hammerspoon/init.lua. Here's the contents of both:

# init.lua
-- Imports
local homeNetwork = require "network"

-- Toggle WiFi based on Ethernet being connected or not
homeNetwork.setEthernetInterface("USB 10/100/1000 LAN")
systemWatcher = hs.caffeinate.watcher.new(homeNetwork.handleWifi)

# network.lua
local M = {}
local ethernetInterface

local function isEthernetConnected()
    ipv4 = hs.network.primaryInterfaces()
    activeInterfaceName = hs.network.interfaceName(ipv4)

    return activeInterfaceName == ethernetInterface

local function toggleWifi()
    desiredState = not isEthernetConnected() and true or false

    if hs.wifi.interfaceDetails()['power'] ~= desiredState then

        newState = desiredState and "on" or "off"
        hs.alert.show("Turning wifi " .. newState)
        hs.alert.show("Wifi already in the desired state")

function M.setEthernetInterface(ethernetInterfaceName)
    ethernetInterface = ethernetInterfaceName

function M.handleWifi(event)
    if event == hs.caffeinate.watcher.systemDidWake then
    elseif event == hs.caffeinate.watcher.screensDidUnlock then

return M

The only thing you'll have to customise is the name of your Ethernet interface in init.lua; in my case it's "USB 10/100/1000 LAN" because I'm using a dock. You can find the name for yours in the Network section of your System Preferences.


It hasn't been updated in a while, but ControlPlane handles this very well.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .