Skip to content

Instantly share code, notes, and snippets.

@zackseuberling
Last active January 26, 2024 16:03
Show Gist options
  • Save zackseuberling/2109d7979d43d5ef1cc920b70e931dc0 to your computer and use it in GitHub Desktop.
Save zackseuberling/2109d7979d43d5ef1cc920b70e931dc0 to your computer and use it in GitHub Desktop.
Manually set the WiFi channel for OSX

https://apple.stackexchange.com/questions/131852/how-do-you-force-a-5-ghz-wifi-connection?newreg=2e719fdc19f1412eb8a7b0671c3c4da0

This is a partial-temporary solution. Basically, if the frequencies are on different channel numbers then it is possible to "set" the particular wifi band (worked on OSX Mavericks). steps: 1. Find the channel numbers of 5 GHz and 2.4 Ghz. Are they different? if yes proceed to step 2. 2. Set 5 GHz channel number using airport command.

Detailed instructions:

  1. Open Wireless Diagnostics.app (it is located in /System/Library/CoreServices/Applications).

  2. In the application menu select Window->Utilities (or press cmd+2).Utilities window should appear.

  3. Select WiFi Scan from Utilities window and press Scan Now button. This will show you all available networks, info about them and your active connection.

  4. Now, verify that BSSIDs of 2.4 and 5 Ghz with the same network name are on different channel numbers. If so, then most likely you can change the band by setting the channel number of the desired frequency band. Alternatively for steps 1-4, just type in the terminal

sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport -s
  1. Open the Terminal.app and type:
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport --channel=**num**

where num is the channel number to set. This command will only work under administrator account (so make sure that you are log as an Administrator i.e. su YourAdministratorAccount)

You can check your active connection by re-scanning with Wireless Diagnostics, Alt+Clicking on the WiFi icon on the OSX menu bar, or using the terminal :-).

That's all!

P.S. If you can not set the channel try to turn off the wifi device before using the airport command.

@affandhia
Copy link

Hey thank you for sharing this! Should you run this airport --channel=**num**, how do you revert it back to normal?

@stevenirby
Copy link

stevenirby commented Feb 17, 2022

This doesn't work anymore for macOS 11+.

@dexomk
Copy link

dexomk commented Feb 24, 2023

Hi Stevenirby, how come it doesn't work? Is there another way to reach this?

@gulsoy83
Copy link

idk if it works or not but if it does, is there any way to revert it to the original value?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment