Can AppleScript or any other script measure a Macbook's wifi signal strength?
Clash Royale CLAN TAG#URR8PPP
up vote
3
down vote
favorite
At my home I have two separate routers due to poor signals when being in one location opposed to another.
When I work on my Macbook from different locations I find it annoying when I have to switch between routers. The eventual goal is to run a more complex script under launchd
to identify if a better networks is present and automate the change over.
I've tried experimenting with networksetup -listnetworkserviceorder
and networksetup -listallhardwareports
but have had no luck.
In AppleScript or any other scripting language a way to measure two router's strength similar to what's visible on the menu bar's wifi signal?
macos network applescript wifi automation
add a comment |Â
up vote
3
down vote
favorite
At my home I have two separate routers due to poor signals when being in one location opposed to another.
When I work on my Macbook from different locations I find it annoying when I have to switch between routers. The eventual goal is to run a more complex script under launchd
to identify if a better networks is present and automate the change over.
I've tried experimenting with networksetup -listnetworkserviceorder
and networksetup -listallhardwareports
but have had no luck.
In AppleScript or any other scripting language a way to measure two router's strength similar to what's visible on the menu bar's wifi signal?
macos network applescript wifi automation
add a comment |Â
up vote
3
down vote
favorite
up vote
3
down vote
favorite
At my home I have two separate routers due to poor signals when being in one location opposed to another.
When I work on my Macbook from different locations I find it annoying when I have to switch between routers. The eventual goal is to run a more complex script under launchd
to identify if a better networks is present and automate the change over.
I've tried experimenting with networksetup -listnetworkserviceorder
and networksetup -listallhardwareports
but have had no luck.
In AppleScript or any other scripting language a way to measure two router's strength similar to what's visible on the menu bar's wifi signal?
macos network applescript wifi automation
At my home I have two separate routers due to poor signals when being in one location opposed to another.
When I work on my Macbook from different locations I find it annoying when I have to switch between routers. The eventual goal is to run a more complex script under launchd
to identify if a better networks is present and automate the change over.
I've tried experimenting with networksetup -listnetworkserviceorder
and networksetup -listallhardwareports
but have had no luck.
In AppleScript or any other scripting language a way to measure two router's strength similar to what's visible on the menu bar's wifi signal?
macos network applescript wifi automation
macos network applescript wifi automation
edited 28 mins ago


bmike♦
153k46272596
153k46272596
asked 2 hours ago


ʀ2ᴅ2
4611518
4611518
add a comment |Â
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
Your Mac can do that for you already.
Of course you have to have set up both routers as Automatically Join and at the top of your list.
Then tell it to roam and it will automatically connect to next stronger signal network.
Even better is if your SSID and WPA are the same for both.
To turn the roaming on in case it was off do this in Terminal:
sudo defaults write /Library/Preferences/com.apple.airport.opproam enabled -bool true
Then set it up to automatically join next strongest access point
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport prefs joinMode=Strongest
You are done, now you can move around and your Mac will keep you connected to the strongest signal.
More reading material here
And Apple explains it how it works
add a comment |Â
up vote
1
down vote
Here's a JavaScript for Automation (JXA) script that will scan for WiFi networks and retrieve the SSIDs and RSSI values:
ObjC.import('CoreWLAN');
nil = $();
const defaultInterface = $.CWWiFiClient.sharedWiFiClient.interface;
const networks = defaultInterface
.scanForNetworksWithNameError(nil,nil)
.allObjects;
const ssids = ObjC.deepUnwrap(networks.valueForKey('ssid'));
const rssiValues = ObjC.deepUnwrap(networks.valueForKey('rssiValue'));
const WiFi = ssids.reduce((ξ, item, i)=>
ξ[item] = rssiValues[i];
return ξ;
, )
var WiFiByStrength = ;
Object.keys(WiFi).sort((i,j)=> return WiFi[j] - WiFi[i]; )
.map(key=>WiFiByStrength[key] = WiFi[key]);
WiFiByStrength
It presents the output of key-value pairs sorted by signal strength (RSSI) in order, starting with the strongest WiFi network signal first:
"CK.net":-38, "NCC-1701-D":-59, "Peter's Wi-Fi Network":-67,
"BTWifi-X":-68, "BTWifi-with-FON":-68, "BTHub4-WMJM":-68
Here, the RSSI values are negative numbers, with a number closer to 0 (more positive) indicative of a stronger WiFi signal.
NB. If you'd prefer this script in AppleScript, I could probably do that for you as well. I just chose JXA because it handles Cocoa value types with less fuss. But now the script is written, it's fairly straightforward to translate it.
add a comment |Â
up vote
1
down vote
Yes - both the current network and potential networks can be scripted from unix command line / shell so that extends to most automation languages - including AppleScript. I'd make your final program in python or swift, but here's how to start your process with signal strength.
Getting the current connected network is easy and quick. The relevant entries for signal and noise are the raw radio values on the channel negotiated but it would be better to key off Transmit Rate since as long as you have faster than X network, it doesn't really matter what noise / signal since the transmit rate drops down when the signal drops or the noise raises.
system_profiler SPAirPortDataType
:
AC88U_5G:
PHY Mode: 802.11ac
BSSID: 54:36:9b:2d:78:e2
Channel: 149
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -26 dBm / -81 dBm
Transmit Rate: 867
MCS Index: 9
Other Local Wi-Fi Networks:
AC88U:
PHY Mode: 802.11n
BSSID: 54:36:9b:2d:78:e1
Channel: 7
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -18 dBm / 0 dBm
Scanning all possible radios and channels is quite slower (5 to 10 seconds instead of a fraction of a second to run) than the simple dump above, so you'd need a program to handle that or a script that's a lot more savvy. I'd start with airport --scan
and filter for your preferred SSID or known MAC address on your base stations:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --scan
Once you've scanned, the system_profiler
should report more results as the scan results seem to be cached locally for a while.
WiFi engineers perform this optimization all the time by controlling the MCS / Transmit rate. Simply choose all transmit rates you wish to evict all clients for your main radio and once they lose connection at the preferred high speeds, all OS will drop and then pick up the next radio that's available. Much easier than rolling out custom scripts to all the devices that connect to your two radios.
Also, it goes without saying - if you could make both radios broadcast on the same SSID - then your Apple products would just roam but maybe you have a good reason to not have the same network name and simplify your work.
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you add some detail on how to read the output, especially on how to decide which Wi-Fi is stronger?
– nohillside♦
1 hour ago
@nohillside Ok,I am not good at script, but I will try a simple one.
– maP1E bluE
1 hour ago
I got you @maP1EbluE - This is a very well known design problem for WiFi engineers. The RSSI and Signal are bad things to automate, but if the OP wants signal - it's there. The real two items to key on are MCS Index and Transmit rate and your answer is perfect to get a measure for when the OP wants to start the drop process. Trying to write the whole program / script is far too broad for one question so your answer should be perfect for how to get started. +1
– bmike♦
21 mins ago
I didn‘t ask for a script actually, but just an explanation on which of the values are important.
– nohillside♦
10 mins ago
@nohillside You didn't ask for a script, but the OP had it after the main question. I've edited the question to make this not too broad. There's some good info - hopefully I didn't add too many words here - please anyone pare down my text if the short answer ofairport --getinfo
andairport --scan
is all that's needed here and the explanation to look at transmit rate when you wish to bail on a network instead of RSSI / SNR / Signal / Noise decibel values.
– bmike♦
8 mins ago
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
Your Mac can do that for you already.
Of course you have to have set up both routers as Automatically Join and at the top of your list.
Then tell it to roam and it will automatically connect to next stronger signal network.
Even better is if your SSID and WPA are the same for both.
To turn the roaming on in case it was off do this in Terminal:
sudo defaults write /Library/Preferences/com.apple.airport.opproam enabled -bool true
Then set it up to automatically join next strongest access point
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport prefs joinMode=Strongest
You are done, now you can move around and your Mac will keep you connected to the strongest signal.
More reading material here
And Apple explains it how it works
add a comment |Â
up vote
1
down vote
Your Mac can do that for you already.
Of course you have to have set up both routers as Automatically Join and at the top of your list.
Then tell it to roam and it will automatically connect to next stronger signal network.
Even better is if your SSID and WPA are the same for both.
To turn the roaming on in case it was off do this in Terminal:
sudo defaults write /Library/Preferences/com.apple.airport.opproam enabled -bool true
Then set it up to automatically join next strongest access point
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport prefs joinMode=Strongest
You are done, now you can move around and your Mac will keep you connected to the strongest signal.
More reading material here
And Apple explains it how it works
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Your Mac can do that for you already.
Of course you have to have set up both routers as Automatically Join and at the top of your list.
Then tell it to roam and it will automatically connect to next stronger signal network.
Even better is if your SSID and WPA are the same for both.
To turn the roaming on in case it was off do this in Terminal:
sudo defaults write /Library/Preferences/com.apple.airport.opproam enabled -bool true
Then set it up to automatically join next strongest access point
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport prefs joinMode=Strongest
You are done, now you can move around and your Mac will keep you connected to the strongest signal.
More reading material here
And Apple explains it how it works
Your Mac can do that for you already.
Of course you have to have set up both routers as Automatically Join and at the top of your list.
Then tell it to roam and it will automatically connect to next stronger signal network.
Even better is if your SSID and WPA are the same for both.
To turn the roaming on in case it was off do this in Terminal:
sudo defaults write /Library/Preferences/com.apple.airport.opproam enabled -bool true
Then set it up to automatically join next strongest access point
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport prefs joinMode=Strongest
You are done, now you can move around and your Mac will keep you connected to the strongest signal.
More reading material here
And Apple explains it how it works
edited 57 mins ago
answered 1 hour ago


Buscar웃
34.3k539111
34.3k539111
add a comment |Â
add a comment |Â
up vote
1
down vote
Here's a JavaScript for Automation (JXA) script that will scan for WiFi networks and retrieve the SSIDs and RSSI values:
ObjC.import('CoreWLAN');
nil = $();
const defaultInterface = $.CWWiFiClient.sharedWiFiClient.interface;
const networks = defaultInterface
.scanForNetworksWithNameError(nil,nil)
.allObjects;
const ssids = ObjC.deepUnwrap(networks.valueForKey('ssid'));
const rssiValues = ObjC.deepUnwrap(networks.valueForKey('rssiValue'));
const WiFi = ssids.reduce((ξ, item, i)=>
ξ[item] = rssiValues[i];
return ξ;
, )
var WiFiByStrength = ;
Object.keys(WiFi).sort((i,j)=> return WiFi[j] - WiFi[i]; )
.map(key=>WiFiByStrength[key] = WiFi[key]);
WiFiByStrength
It presents the output of key-value pairs sorted by signal strength (RSSI) in order, starting with the strongest WiFi network signal first:
"CK.net":-38, "NCC-1701-D":-59, "Peter's Wi-Fi Network":-67,
"BTWifi-X":-68, "BTWifi-with-FON":-68, "BTHub4-WMJM":-68
Here, the RSSI values are negative numbers, with a number closer to 0 (more positive) indicative of a stronger WiFi signal.
NB. If you'd prefer this script in AppleScript, I could probably do that for you as well. I just chose JXA because it handles Cocoa value types with less fuss. But now the script is written, it's fairly straightforward to translate it.
add a comment |Â
up vote
1
down vote
Here's a JavaScript for Automation (JXA) script that will scan for WiFi networks and retrieve the SSIDs and RSSI values:
ObjC.import('CoreWLAN');
nil = $();
const defaultInterface = $.CWWiFiClient.sharedWiFiClient.interface;
const networks = defaultInterface
.scanForNetworksWithNameError(nil,nil)
.allObjects;
const ssids = ObjC.deepUnwrap(networks.valueForKey('ssid'));
const rssiValues = ObjC.deepUnwrap(networks.valueForKey('rssiValue'));
const WiFi = ssids.reduce((ξ, item, i)=>
ξ[item] = rssiValues[i];
return ξ;
, )
var WiFiByStrength = ;
Object.keys(WiFi).sort((i,j)=> return WiFi[j] - WiFi[i]; )
.map(key=>WiFiByStrength[key] = WiFi[key]);
WiFiByStrength
It presents the output of key-value pairs sorted by signal strength (RSSI) in order, starting with the strongest WiFi network signal first:
"CK.net":-38, "NCC-1701-D":-59, "Peter's Wi-Fi Network":-67,
"BTWifi-X":-68, "BTWifi-with-FON":-68, "BTHub4-WMJM":-68
Here, the RSSI values are negative numbers, with a number closer to 0 (more positive) indicative of a stronger WiFi signal.
NB. If you'd prefer this script in AppleScript, I could probably do that for you as well. I just chose JXA because it handles Cocoa value types with less fuss. But now the script is written, it's fairly straightforward to translate it.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Here's a JavaScript for Automation (JXA) script that will scan for WiFi networks and retrieve the SSIDs and RSSI values:
ObjC.import('CoreWLAN');
nil = $();
const defaultInterface = $.CWWiFiClient.sharedWiFiClient.interface;
const networks = defaultInterface
.scanForNetworksWithNameError(nil,nil)
.allObjects;
const ssids = ObjC.deepUnwrap(networks.valueForKey('ssid'));
const rssiValues = ObjC.deepUnwrap(networks.valueForKey('rssiValue'));
const WiFi = ssids.reduce((ξ, item, i)=>
ξ[item] = rssiValues[i];
return ξ;
, )
var WiFiByStrength = ;
Object.keys(WiFi).sort((i,j)=> return WiFi[j] - WiFi[i]; )
.map(key=>WiFiByStrength[key] = WiFi[key]);
WiFiByStrength
It presents the output of key-value pairs sorted by signal strength (RSSI) in order, starting with the strongest WiFi network signal first:
"CK.net":-38, "NCC-1701-D":-59, "Peter's Wi-Fi Network":-67,
"BTWifi-X":-68, "BTWifi-with-FON":-68, "BTHub4-WMJM":-68
Here, the RSSI values are negative numbers, with a number closer to 0 (more positive) indicative of a stronger WiFi signal.
NB. If you'd prefer this script in AppleScript, I could probably do that for you as well. I just chose JXA because it handles Cocoa value types with less fuss. But now the script is written, it's fairly straightforward to translate it.
Here's a JavaScript for Automation (JXA) script that will scan for WiFi networks and retrieve the SSIDs and RSSI values:
ObjC.import('CoreWLAN');
nil = $();
const defaultInterface = $.CWWiFiClient.sharedWiFiClient.interface;
const networks = defaultInterface
.scanForNetworksWithNameError(nil,nil)
.allObjects;
const ssids = ObjC.deepUnwrap(networks.valueForKey('ssid'));
const rssiValues = ObjC.deepUnwrap(networks.valueForKey('rssiValue'));
const WiFi = ssids.reduce((ξ, item, i)=>
ξ[item] = rssiValues[i];
return ξ;
, )
var WiFiByStrength = ;
Object.keys(WiFi).sort((i,j)=> return WiFi[j] - WiFi[i]; )
.map(key=>WiFiByStrength[key] = WiFi[key]);
WiFiByStrength
It presents the output of key-value pairs sorted by signal strength (RSSI) in order, starting with the strongest WiFi network signal first:
"CK.net":-38, "NCC-1701-D":-59, "Peter's Wi-Fi Network":-67,
"BTWifi-X":-68, "BTWifi-with-FON":-68, "BTHub4-WMJM":-68
Here, the RSSI values are negative numbers, with a number closer to 0 (more positive) indicative of a stronger WiFi signal.
NB. If you'd prefer this script in AppleScript, I could probably do that for you as well. I just chose JXA because it handles Cocoa value types with less fuss. But now the script is written, it's fairly straightforward to translate it.
answered 30 mins ago
CJK
2,05311
2,05311
add a comment |Â
add a comment |Â
up vote
1
down vote
Yes - both the current network and potential networks can be scripted from unix command line / shell so that extends to most automation languages - including AppleScript. I'd make your final program in python or swift, but here's how to start your process with signal strength.
Getting the current connected network is easy and quick. The relevant entries for signal and noise are the raw radio values on the channel negotiated but it would be better to key off Transmit Rate since as long as you have faster than X network, it doesn't really matter what noise / signal since the transmit rate drops down when the signal drops or the noise raises.
system_profiler SPAirPortDataType
:
AC88U_5G:
PHY Mode: 802.11ac
BSSID: 54:36:9b:2d:78:e2
Channel: 149
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -26 dBm / -81 dBm
Transmit Rate: 867
MCS Index: 9
Other Local Wi-Fi Networks:
AC88U:
PHY Mode: 802.11n
BSSID: 54:36:9b:2d:78:e1
Channel: 7
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -18 dBm / 0 dBm
Scanning all possible radios and channels is quite slower (5 to 10 seconds instead of a fraction of a second to run) than the simple dump above, so you'd need a program to handle that or a script that's a lot more savvy. I'd start with airport --scan
and filter for your preferred SSID or known MAC address on your base stations:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --scan
Once you've scanned, the system_profiler
should report more results as the scan results seem to be cached locally for a while.
WiFi engineers perform this optimization all the time by controlling the MCS / Transmit rate. Simply choose all transmit rates you wish to evict all clients for your main radio and once they lose connection at the preferred high speeds, all OS will drop and then pick up the next radio that's available. Much easier than rolling out custom scripts to all the devices that connect to your two radios.
Also, it goes without saying - if you could make both radios broadcast on the same SSID - then your Apple products would just roam but maybe you have a good reason to not have the same network name and simplify your work.
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you add some detail on how to read the output, especially on how to decide which Wi-Fi is stronger?
– nohillside♦
1 hour ago
@nohillside Ok,I am not good at script, but I will try a simple one.
– maP1E bluE
1 hour ago
I got you @maP1EbluE - This is a very well known design problem for WiFi engineers. The RSSI and Signal are bad things to automate, but if the OP wants signal - it's there. The real two items to key on are MCS Index and Transmit rate and your answer is perfect to get a measure for when the OP wants to start the drop process. Trying to write the whole program / script is far too broad for one question so your answer should be perfect for how to get started. +1
– bmike♦
21 mins ago
I didn‘t ask for a script actually, but just an explanation on which of the values are important.
– nohillside♦
10 mins ago
@nohillside You didn't ask for a script, but the OP had it after the main question. I've edited the question to make this not too broad. There's some good info - hopefully I didn't add too many words here - please anyone pare down my text if the short answer ofairport --getinfo
andairport --scan
is all that's needed here and the explanation to look at transmit rate when you wish to bail on a network instead of RSSI / SNR / Signal / Noise decibel values.
– bmike♦
8 mins ago
add a comment |Â
up vote
1
down vote
Yes - both the current network and potential networks can be scripted from unix command line / shell so that extends to most automation languages - including AppleScript. I'd make your final program in python or swift, but here's how to start your process with signal strength.
Getting the current connected network is easy and quick. The relevant entries for signal and noise are the raw radio values on the channel negotiated but it would be better to key off Transmit Rate since as long as you have faster than X network, it doesn't really matter what noise / signal since the transmit rate drops down when the signal drops or the noise raises.
system_profiler SPAirPortDataType
:
AC88U_5G:
PHY Mode: 802.11ac
BSSID: 54:36:9b:2d:78:e2
Channel: 149
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -26 dBm / -81 dBm
Transmit Rate: 867
MCS Index: 9
Other Local Wi-Fi Networks:
AC88U:
PHY Mode: 802.11n
BSSID: 54:36:9b:2d:78:e1
Channel: 7
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -18 dBm / 0 dBm
Scanning all possible radios and channels is quite slower (5 to 10 seconds instead of a fraction of a second to run) than the simple dump above, so you'd need a program to handle that or a script that's a lot more savvy. I'd start with airport --scan
and filter for your preferred SSID or known MAC address on your base stations:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --scan
Once you've scanned, the system_profiler
should report more results as the scan results seem to be cached locally for a while.
WiFi engineers perform this optimization all the time by controlling the MCS / Transmit rate. Simply choose all transmit rates you wish to evict all clients for your main radio and once they lose connection at the preferred high speeds, all OS will drop and then pick up the next radio that's available. Much easier than rolling out custom scripts to all the devices that connect to your two radios.
Also, it goes without saying - if you could make both radios broadcast on the same SSID - then your Apple products would just roam but maybe you have a good reason to not have the same network name and simplify your work.
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you add some detail on how to read the output, especially on how to decide which Wi-Fi is stronger?
– nohillside♦
1 hour ago
@nohillside Ok,I am not good at script, but I will try a simple one.
– maP1E bluE
1 hour ago
I got you @maP1EbluE - This is a very well known design problem for WiFi engineers. The RSSI and Signal are bad things to automate, but if the OP wants signal - it's there. The real two items to key on are MCS Index and Transmit rate and your answer is perfect to get a measure for when the OP wants to start the drop process. Trying to write the whole program / script is far too broad for one question so your answer should be perfect for how to get started. +1
– bmike♦
21 mins ago
I didn‘t ask for a script actually, but just an explanation on which of the values are important.
– nohillside♦
10 mins ago
@nohillside You didn't ask for a script, but the OP had it after the main question. I've edited the question to make this not too broad. There's some good info - hopefully I didn't add too many words here - please anyone pare down my text if the short answer ofairport --getinfo
andairport --scan
is all that's needed here and the explanation to look at transmit rate when you wish to bail on a network instead of RSSI / SNR / Signal / Noise decibel values.
– bmike♦
8 mins ago
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Yes - both the current network and potential networks can be scripted from unix command line / shell so that extends to most automation languages - including AppleScript. I'd make your final program in python or swift, but here's how to start your process with signal strength.
Getting the current connected network is easy and quick. The relevant entries for signal and noise are the raw radio values on the channel negotiated but it would be better to key off Transmit Rate since as long as you have faster than X network, it doesn't really matter what noise / signal since the transmit rate drops down when the signal drops or the noise raises.
system_profiler SPAirPortDataType
:
AC88U_5G:
PHY Mode: 802.11ac
BSSID: 54:36:9b:2d:78:e2
Channel: 149
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -26 dBm / -81 dBm
Transmit Rate: 867
MCS Index: 9
Other Local Wi-Fi Networks:
AC88U:
PHY Mode: 802.11n
BSSID: 54:36:9b:2d:78:e1
Channel: 7
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -18 dBm / 0 dBm
Scanning all possible radios and channels is quite slower (5 to 10 seconds instead of a fraction of a second to run) than the simple dump above, so you'd need a program to handle that or a script that's a lot more savvy. I'd start with airport --scan
and filter for your preferred SSID or known MAC address on your base stations:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --scan
Once you've scanned, the system_profiler
should report more results as the scan results seem to be cached locally for a while.
WiFi engineers perform this optimization all the time by controlling the MCS / Transmit rate. Simply choose all transmit rates you wish to evict all clients for your main radio and once they lose connection at the preferred high speeds, all OS will drop and then pick up the next radio that's available. Much easier than rolling out custom scripts to all the devices that connect to your two radios.
Also, it goes without saying - if you could make both radios broadcast on the same SSID - then your Apple products would just roam but maybe you have a good reason to not have the same network name and simplify your work.
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Yes - both the current network and potential networks can be scripted from unix command line / shell so that extends to most automation languages - including AppleScript. I'd make your final program in python or swift, but here's how to start your process with signal strength.
Getting the current connected network is easy and quick. The relevant entries for signal and noise are the raw radio values on the channel negotiated but it would be better to key off Transmit Rate since as long as you have faster than X network, it doesn't really matter what noise / signal since the transmit rate drops down when the signal drops or the noise raises.
system_profiler SPAirPortDataType
:
AC88U_5G:
PHY Mode: 802.11ac
BSSID: 54:36:9b:2d:78:e2
Channel: 149
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -26 dBm / -81 dBm
Transmit Rate: 867
MCS Index: 9
Other Local Wi-Fi Networks:
AC88U:
PHY Mode: 802.11n
BSSID: 54:36:9b:2d:78:e1
Channel: 7
Country Code: CN
Network Type: Infrastructure
Security: WPA2 Personal
Signal / Noise: -18 dBm / 0 dBm
Scanning all possible radios and channels is quite slower (5 to 10 seconds instead of a fraction of a second to run) than the simple dump above, so you'd need a program to handle that or a script that's a lot more savvy. I'd start with airport --scan
and filter for your preferred SSID or known MAC address on your base stations:
/System/Library/PrivateFrameworks/Apple80211.framework/Versions/A/Resources/airport --scan
Once you've scanned, the system_profiler
should report more results as the scan results seem to be cached locally for a while.
WiFi engineers perform this optimization all the time by controlling the MCS / Transmit rate. Simply choose all transmit rates you wish to evict all clients for your main radio and once they lose connection at the preferred high speeds, all OS will drop and then pick up the next radio that's available. Much easier than rolling out custom scripts to all the devices that connect to your two radios.
Also, it goes without saying - if you could make both radios broadcast on the same SSID - then your Apple products would just roam but maybe you have a good reason to not have the same network name and simplify your work.
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 10 mins ago


bmike♦
153k46272596
153k46272596
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
answered 1 hour ago


maP1E bluE
1716
1716
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
maP1E bluE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Can you add some detail on how to read the output, especially on how to decide which Wi-Fi is stronger?
– nohillside♦
1 hour ago
@nohillside Ok,I am not good at script, but I will try a simple one.
– maP1E bluE
1 hour ago
I got you @maP1EbluE - This is a very well known design problem for WiFi engineers. The RSSI and Signal are bad things to automate, but if the OP wants signal - it's there. The real two items to key on are MCS Index and Transmit rate and your answer is perfect to get a measure for when the OP wants to start the drop process. Trying to write the whole program / script is far too broad for one question so your answer should be perfect for how to get started. +1
– bmike♦
21 mins ago
I didn‘t ask for a script actually, but just an explanation on which of the values are important.
– nohillside♦
10 mins ago
@nohillside You didn't ask for a script, but the OP had it after the main question. I've edited the question to make this not too broad. There's some good info - hopefully I didn't add too many words here - please anyone pare down my text if the short answer ofairport --getinfo
andairport --scan
is all that's needed here and the explanation to look at transmit rate when you wish to bail on a network instead of RSSI / SNR / Signal / Noise decibel values.
– bmike♦
8 mins ago
add a comment |Â
Can you add some detail on how to read the output, especially on how to decide which Wi-Fi is stronger?
– nohillside♦
1 hour ago
@nohillside Ok,I am not good at script, but I will try a simple one.
– maP1E bluE
1 hour ago
I got you @maP1EbluE - This is a very well known design problem for WiFi engineers. The RSSI and Signal are bad things to automate, but if the OP wants signal - it's there. The real two items to key on are MCS Index and Transmit rate and your answer is perfect to get a measure for when the OP wants to start the drop process. Trying to write the whole program / script is far too broad for one question so your answer should be perfect for how to get started. +1
– bmike♦
21 mins ago
I didn‘t ask for a script actually, but just an explanation on which of the values are important.
– nohillside♦
10 mins ago
@nohillside You didn't ask for a script, but the OP had it after the main question. I've edited the question to make this not too broad. There's some good info - hopefully I didn't add too many words here - please anyone pare down my text if the short answer ofairport --getinfo
andairport --scan
is all that's needed here and the explanation to look at transmit rate when you wish to bail on a network instead of RSSI / SNR / Signal / Noise decibel values.
– bmike♦
8 mins ago
Can you add some detail on how to read the output, especially on how to decide which Wi-Fi is stronger?
– nohillside♦
1 hour ago
Can you add some detail on how to read the output, especially on how to decide which Wi-Fi is stronger?
– nohillside♦
1 hour ago
@nohillside Ok,I am not good at script, but I will try a simple one.
– maP1E bluE
1 hour ago
@nohillside Ok,I am not good at script, but I will try a simple one.
– maP1E bluE
1 hour ago
I got you @maP1EbluE - This is a very well known design problem for WiFi engineers. The RSSI and Signal are bad things to automate, but if the OP wants signal - it's there. The real two items to key on are MCS Index and Transmit rate and your answer is perfect to get a measure for when the OP wants to start the drop process. Trying to write the whole program / script is far too broad for one question so your answer should be perfect for how to get started. +1
– bmike♦
21 mins ago
I got you @maP1EbluE - This is a very well known design problem for WiFi engineers. The RSSI and Signal are bad things to automate, but if the OP wants signal - it's there. The real two items to key on are MCS Index and Transmit rate and your answer is perfect to get a measure for when the OP wants to start the drop process. Trying to write the whole program / script is far too broad for one question so your answer should be perfect for how to get started. +1
– bmike♦
21 mins ago
I didn‘t ask for a script actually, but just an explanation on which of the values are important.
– nohillside♦
10 mins ago
I didn‘t ask for a script actually, but just an explanation on which of the values are important.
– nohillside♦
10 mins ago
@nohillside You didn't ask for a script, but the OP had it after the main question. I've edited the question to make this not too broad. There's some good info - hopefully I didn't add too many words here - please anyone pare down my text if the short answer of
airport --getinfo
and airport --scan
is all that's needed here and the explanation to look at transmit rate when you wish to bail on a network instead of RSSI / SNR / Signal / Noise decibel values.– bmike♦
8 mins ago
@nohillside You didn't ask for a script, but the OP had it after the main question. I've edited the question to make this not too broad. There's some good info - hopefully I didn't add too many words here - please anyone pare down my text if the short answer of
airport --getinfo
and airport --scan
is all that's needed here and the explanation to look at transmit rate when you wish to bail on a network instead of RSSI / SNR / Signal / Noise decibel values.– bmike♦
8 mins ago
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fapple.stackexchange.com%2fquestions%2f341656%2fcan-applescript-or-any-other-script-measure-a-macbooks-wifi-signal-strength%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password