Relevant Music

Mac OS: Use HUAWEI 3G modem without Mobile Partner

The HUAWEI Mobile Partner software is written in Java and seems to be mandatory to connect with HUAWEI’s mobile devices, but I think it is really annoying to always keep this heavyweight piece of software open while accessing the Internet.

The device will also appear in Apple’s built-in Network Manager, once the drivers are installed. But unless the PIN is disabled, trying to use the Network Manager (System Preferences > Network) will fail. In a next step, I tried to open Mobile Partner for entering the PIN, but then closing it without connection initiation. After entering the PIN, the connection via the Network Manager seemed to work fine! So we need a solution to enter the PIN without using the Mobile Partner software.

Eventually, I found the following solution at It requires that drivers are already installed, e.g. by using the installers from HUAWEI. It works with my HUAWEI Mobile Connect E160 card (o2 Surf Stick).

An alternative to this solution is to disable the PIN completely, but be sure if somebody steals your surf stick or your SIM card, he will be able to use your Internet connection and possibly do illegal stuff.


  • Some knowledge about shell scripting
  • I have only tested the script on Mac OS X Lion, but the solution may also work well with other Mac OS X versions. If the script works with other versions, too, please post a comment.
  • I don’t know for which HUAWEI devices this solution exactly works, I have only tested it with my HUAWEI Mobile Connect E160 card. If it works for other devices, too, please post a comment.
  • The HUAWEI drivers must be installed, you may also install Mobile Partner first, just to test if it works with the drivers as it should.

Setting up the script that enters your PIN

First, you need to download the script. You may download it from, I have also mirrored it. Copy it wherever you want, e.g. into a scripts folder. Then, follow Mr. Bunbury’s instructions to create a pin in the Keychain:

In order to use this script you have to create a Keychain entry under the
account ‘simpin’. Here is how:
1. Open Keychain Access (placed in Utilities folder of Applications)
2. Menu: File -> New Password Item
3. Keychain Item Name: Enter something usefull to you
4. Account Name: simpin
5. Password: Enter the PIN to your SIM card (usually a number)
6. Press ‘Add’
7. When this scripts is executed the first time, a window will appear
asking you to allow access of this keychain.
8. Enjoy!

I have skipped this step and put my PIN directly into the script by replacing the line my $pin = &getSIMPIN; with my $pin = “1234″, since I feel secure on my encrypted hard disk. But be aware that if the thief has access to your hard drive (stolen laptop and surf stick), a plain-text PIN is easy to discover. Be sure that the PIN is the correct one in order not to be locked out.

Setting up the network connection

Depending on your mobile internet provider, your network connection settings should look like this:

Especially the phone number, username and password may vary, ask your provider for the correct settings. It is also convenient to check “Show modem state in the menu” or whatever “Modemstatus in der Menüleiste anzeigen” is in English.

Testing the script

In the following, we assume that the script is placed at /Users/user/scripts/ .

Plug the surf stick in and launch the script by running perl /Users/user/scripts/ The script should now have entered your PIN into the Surf Stick. Then, try to connect with the network manager. If you have checked “Show modem state in the menu”, you can do this by using the icon in the menu bar. With the PIN entered by the script, the network connection should now succeed.

Doing PIN entry and network connection in one step

To make one single step out of both steps, we create another script by creating a new file surfstick-connect.command, we assume the file is placed in /Users/user/scripts/ again. Put the following lines into the file:


echo "Entering PIN..."
perl /Users/user/scripts/ || exit 1
echo "Entered Pin."
echo "Connecting..."
networksetup -connectpppoeservice "o2 Surf Stick"
echo "See menu bar for connection status."

Then, you must replace the path to with your own path to and “o2 Surf Stick” with the name of the network connection you have set up for your surf stick.

Now, run chmod 755 /Users/user/scripts/surfstick-connect.command to make the script executable.

Run /Users/user/scripts/surfstick-connect.command. Now, the script should enter your PIN and then connect to the Internet connection you have set up.

One-Click Internet connection – Create a Launchpad/Dock icon

Follow the instructions in my other post to create a launcher icon from the script surfstick-connect.command. With our example path, the corresponding command is ‘sh “Connect Surf Stick”  /Users/user/scripts/surfstick-connect.command’

With this last step, you only need to plug in your surf stick and click onto the app icon created, and everything is done to connect to the Internet in one step.

Relevant Music © 2003-2006 Leo Nobach. Blog proudly powered by WordPress