Mac – Set your static IP address fast!

A quick update on the last post – but for OS X!

The OS X terminal is more comfortable than the Windows CLI for route/switch guys like me. Here’s how I make quick IP changes in OS X.

You can create command aliases just like in Cisco IOS by adding them to the profile that terminal loads when you open the app. Just open terminal, and type “open .profile”. Here I’ve done just that, and you can see my terminal profile:

profile Sublime Text, Today at 10.21.49 AM

If you’ve never messed with the terminal profile, it will likely be empty. But the basic syntax is straightforward. Save the file and close/reopen terminal for the aliases to become available.

Here are a couple of my examples:

  • “setair” will statically set my Wi-Fi adapter address
  • “setethdhcp” will revert my ethernet NIC to DHCP
  • “shair” is like ipconfig in Windows, or a simpler version of ifconfig for OS X:

shair— -bash — 139×39 Terminal, Today at 10.26.43 AM.png

Note that any commands running SUDO will prompt you for your elevated password.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s