How to Toggle WiFi on and Off with a Keyboard Shortcut on Mac

Part 1 of 2:

Creating the Action

  1. Open Terminal. Copy paste this in: networksetup -listnetworkserviceorder.
  2. Remember the number that shows the WiFi. Then, you can close Terminal and open Automator.
  3. Choose a type for your document. Click on Quick Action and Choose.
  4. Search for run shell script in the search bar on the left. Double click on it.
  5. Make sure the top section is correct on the right: Workflow receives no input in any application.
  6. Copy and paste the following script into the section of 'Run Shell Script,' substituting 'X' with any number that you found the WiFi port to be earlier. The script is networksetup -getairportpower enX .
  7. Click on Run in the top right corner. See if your WiFi turns off. You might need to wait a few seconds. If it works, click on the X and save the action, and name it something obvious like 'WiFi Toggle.' Then, proceed to the next section.
Part 2 of 2:

Creating the Keyboard Shortcut.

  1. Open System Preferences > Keyboard. At the top, click on Shortcuts.
  2. Click on Services. Scroll to the very bottom until you find the action that you just created.
  3. Click on the None to the right of the name. Then, click on Add Shortcut.
  4. Type in your shortcut. You might use Ctrl+ Opt+ Cmd+W. Control Option Command W). Make sure the shortcut is not a common shortcut.
  5. Test your shortcut. It should work!
4.1 ★ | 266 Vote

May be interested

  • How to Use Your Wii Remote As a Mouse on a MacPhoto of How to Use Your Wii Remote As a Mouse on a Mac
    you can use your wiimote as an interface device on your mac using specialized software, like darwiinremote or wiji. at the moment development support for darwiinremote only goes up to osx 10.8, while wiiji support has stopped at 10.5...
  • How to Open a Mac MiniPhoto of How to Open a Mac Mini
    the apple mac mini is one of the smallest fully-functional desktop computers available. because of its minimal and compact design, it can be difficult to upgrade any of the components due to space considerations. if you have a reason to...
  • How to Change the Screen Color Display on a MacPhoto of How to Change the Screen Color Display on a Mac
    to change your mac's screen display color, click the apple menu → click system preferences → click display → click the color tab → select a new profile from the list. click the apple menu.
  • How to Install Software on a MacPhoto of How to Install Software on a Mac
    so you've got a mac, it's got so many cool programs out-of-the-box but you've got to have another program. but how do you install this sweet piece of a software on your mac? this article gives you the three main ways applications can be...
  • How to Set a Random Order Screensaver on a MacPhoto of How to Set a Random Order Screensaver on a Mac
    you can set your mac screen saver to choose a random screen saver style. each time your mac goes into screen saver mode, it will choose one of the available styles at random. you can change the source for your photo screen savers so that...
  • How to Use Appcleaner for MacPhoto of How to Use Appcleaner for Mac
    appcleaner is an all-around utility application for mac that lets you select and uninstall any program, widget, or plug-in installed on your computer without leaving any broken files behind. appcleaner removes any files it detects as...