3

Is it possible to create a Ad-hoc Wifi network in OS X using the command line? Without using Apple Script to do it through the UI.

Joakim
  • 161
  • 1
  • 7

2 Answers2

2

I've used sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -i[<arg>] to do the job. Take a look at /usr/sbin/networksetup to round out the solution.

0

As a newer answer for making an ad hoc network that works in Mojave without a internet connection, while searching online, I finally found an answer!

Smoooosher's answer only works with an active connection to share.

To create your own "active" network, in terminal run the 2 following commands.

sudo networksetup -createnetworkservice Loopback lo0
sudo networksetup -setmanual Loopback 172.20.42.42 255.255.255.255

This creates a new network conection that although it looks inactive, it can be shared from the internet sharing preference pane to wifi.