Skip to content

Instantly share code, notes, and snippets.

@bob-codingdutchmen
Created October 16, 2015 08:18
Show Gist options
  • Save bob-codingdutchmen/51055937675e244e4bf6 to your computer and use it in GitHub Desktop.
Save bob-codingdutchmen/51055937675e244e4bf6 to your computer and use it in GitHub Desktop.
Change the carrier string in the iOS Simulator
# This script changes the Carrier string in the iPhone simulator
# to anything you want. It needs python3, and currently works when
# your Simulator is set to English. For other languages, change the
# 'language_code' variable to your language.
#
# This works for Xcode 7 and iOS 9, I havent tested on anything else.
#
# Usage: 'python3 carrier.py new_carrier'
#
# Bob Vork, 2015
import plistlib
import sys
from os import path
if len(sys.argv) != 2:
exit('Usage: \'python3 {} new_carrier\''.format(sys.argv[0]))
new_carrier = sys.argv[1]
language_code = 'en'
plistpath = '/Applications/Xcode.app/Contents/Developer/Platforms/\
iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/System\
/Library/CoreServices/SpringBoard.app/{}.lproj/SpringBoard.strings'.format(
language_code)
if not path.exists(plistpath):
exit('No file found at {}'.format(plistpath))
with open(plistpath, 'rb') as fp:
plistdata = plistlib.load(fp)
plistdata['SIMULATOR_CARRIER_STRING'] = new_carrier
with open(plistpath, 'wb') as fp:
plistlib.dump(plistdata, fp)
print('Carrier now set to \'{}\''.format(new_carrier))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment