In the digital age, efficient network management is critical for both personal and professional environments. On macOS, the terminal offers powerful tools for advanced users to control and customize network settings. One of the most useful commands in this regard is `networksetup`. It allows users to manage multiple network interfaces and proxies seamlessly. Whether you're managing a Wi-Fi network, Ethernet connection, or configuring proxies for specific network interfaces, `networksetup` empowers you with a set of commands to optimize network performance and security. This article explores how to leverage the `networksetup` command for managing multiple network cards and proxy settings, providing practical insights into its usage.
The `networksetup` command is a versatile tool that interacts directly with macOS's network configuration system. Through the terminal, users can configure various network-related settings for Wi-Fi, Ethernet, VPNs, and even proxies. The ability to manage these settings from the command line is particularly useful for advanced users, system administrators, and those who require automation or remote management of network configurations.
The `networksetup` command can be used to manage a wide array of tasks, such as switching between different network interfaces, enabling or disabling Wi-Fi, and modifying proxy settings for specific network connections. By understanding its syntax and how it interacts with the network preferences, users can gain more control over their Mac’s connectivity.
Modern Macs often feature multiple network interfaces, such as Ethernet, Wi-Fi, and possibly Bluetooth or Thunderbolt interfaces. Managing these interfaces effectively is essential for users who need to switch between different networks based on usage or location.
Using `networksetup`, you can quickly list all available network interfaces and check their current status. This is particularly useful in environments with complex network configurations where multiple network interfaces are in use.
Listing Network Interfaces:
To view all network interfaces on your Mac, use the following command:
```
networksetup -listallnetworkservices
```
This command displays all available network services, including active and inactive ones. For example, it could show services like "Wi-Fi," "Ethernet," and any other custom network configurations you’ve created.
Switching Between Network Interfaces:
Switching between network interfaces (such as enabling Wi-Fi and disabling Ethernet) can be done easily with `networksetup`. To enable or disable a specific network interface, use the following commands:
- Enabling Wi-Fi:
```
networksetup -setnetworkserviceenabled Wi-Fi on
```
- Disabling Ethernet:
```
networksetup -setnetworkserviceenabled Ethernet off
```
This allows users to manage their network interfaces based on the context, like using Wi-Fi in a home environment and Ethernet when connected to a wired office network.

One of the most important tasks for users working in secure or corporate environments is configuring proxy settings. Proxies route internet traffic through a specific server, providing benefits such as enhanced privacy, bypassing network restrictions, or optimizing internet performance.
The `networksetup` command offers a convenient way to set up proxies for different network interfaces. This is particularly valuable when using multiple interfaces, as different proxies might be required depending on the network.
Setting Proxy for Wi-Fi or Ethernet:
To configure proxies for a specific interface, you can use the following commands:
- Set HTTP proxy for Wi-Fi:
```
networksetup -setwebproxy Wi-Fi proxy.server.com 8080
```
- Set HTTPS proxy for Ethernet:
```
networksetup -setsecurewebproxy Ethernet proxy.server.com 8080
```
These commands allow you to specify a server address and port number for HTTP and HTTPS traffic. You can also set the proxy for FTP, SOCKS, and more, depending on your needs.
Enabling and Disabling Proxy:
In certain situations, you may need to toggle the proxy settings. You can disable or enable proxies for specific network interfaces like this:
- Disable HTTP proxy for Wi-Fi:
```
networksetup -setwebproxy Wi-Fi off
```
- Enable HTTPS proxy for Ethernet:
```
networksetup -setsecurewebproxy Ethernet on
```
In many business or corporate settings, proxy servers require authentication. This additional layer of security can be easily configured using the `networksetup` command.
Setting Proxy Authentication:
To set up proxy authentication, you can use the following command:
```
networksetup -setwebproxy Wi-Fi proxy.server.com 8080 username password
```
This command enables the proxy with the specified server address and port, while also including the necessary authentication credentials (username and password).
For power users or administrators managing multiple Macs or performing frequent network changes, automating these configurations can save a lot of time. By creating simple shell scripts, you can apply the desired network configurations across multiple machines or networks automatically.

Example Script for Switching Between Networks:
You can create a shell script that toggles between different network interfaces and proxies based on the current network environment. Here’s an example:
```bash
!/bin/bash
Toggle between Wi-Fi and Ethernet
networksetup -setnetworkserviceenabled Wi-Fi on
networksetup -setnetworkserviceenabled Ethernet off
Set proxy for Wi-Fi
networksetup -setwebproxy Wi-Fi proxy.server.com 8080
```
This script will disable the Ethernet connection and enable Wi-Fi, while also setting up a proxy for the Wi-Fi interface.
Mastering the `networksetup` command gives you complete control over your Mac's network configurations. Whether you're managing multiple network interfaces, configuring proxies, or automating network setups, the command provides the flexibility and power needed for advanced network management. For professionals who rely on a stable and optimized network, mastering these tools is essential for maintaining high productivity and security. By leveraging the `networksetup` command, you can ensure that your Mac is always configured to meet your specific networking needs, whether at home, in the office, or on the go.