LinuxCommandLibrary

idevicesetlocation

Set iOS device location for testing

TLDR

Set a specific latitude and longitude

$ idevicesetlocation [latitude] [longitude]
copy

Reset the simulated location
$ idevicesetlocation reset
copy

SYNOPSIS

idevicesetlocation [OPTIONS] [-x <latitude>] [-y <longitude>]
idevicesetlocation [OPTIONS] --restore

PARAMETERS

-u, --udid <udid>
    
Selects a specific device by its 40-character unique device identifier (UDID). If not specified, the command will operate on the first detected device.


-x, --latitude <latitude>
    
Sets the simulated latitude coordinate. Must be provided along with --longitude when setting a new location.


-y, --longitude <longitude>
    
Sets the simulated longitude coordinate. Must be provided along with --latitude when setting a new location.


--restore
    
Disables location simulation and restores the device's ability to report its actual geographic location through its internal GPS or other location services.


-h, --help
    
Displays a concise help message with command usage and available options.


-v, --version
    
Prints the version information of the idevicesetlocation utility.


DESCRIPTION


idevicesetlocation is a command-line utility from the libimobiledevice suite, designed to simulate a specific geographic location (latitude and longitude) on an Apple iOS device connected via USB. This tool is particularly useful for developers and testers who need to test location-based applications without physically moving to different geographical points. It allows for setting a precise virtual GPS coordinate, which the iOS device then reports as its current location. The simulation remains active until explicitly reset or the device is restarted. It leverages Apple's developer APIs to inject these virtual location data, making it a powerful tool for automated testing and debugging of apps that rely on GPS data. The command can also restore the device's actual location sensing by disabling the simulation, making it easy to switch between simulated and real-world scenarios.

CAVEATS


This command requires the iOS device to be in developer mode or have developer images mounted, as it utilizes internal Apple developer APIs for location simulation. The device must be unlocked for the command to execute successfully. The simulated location persists until the device is restarted or the --restore option is used. Not all iOS versions or device models may support this feature uniformly due to Apple's ongoing security and API changes.

PREREQUISITES


For idevicesetlocation to function, libimobiledevice and its development headers must be installed on your system. Additionally, the iOS device must be connected via USB, trusted by the computer, and sometimes requires an active internet connection on the device to properly load map data for location services.

HISTORY


The idevicesetlocation command is part of the libimobiledevice project, an independent, open-source initiative that began around 2007-2008. Its primary goal was to provide a cross-platform, free software library to communicate with Apple's iOS devices using native protocols. Prior to libimobiledevice, interacting with iOS devices programmatically often required Apple's proprietary SDKs, which were limited to macOS. libimobiledevice aimed to break this barrier, enabling Linux and Windows users to develop tools for iOS devices. idevicesetlocation was developed as a crucial utility within this ecosystem, specifically addressing the need for location testing in app development. Its development closely tracked changes in Apple's internal protocols and APIs, adapting to new iOS versions to maintain compatibility and functionality for simulating GPS coordinates, a common requirement for location-aware applications.

SEE ALSO

ideviceinfo(1), idevicescreenshot(1), idevicedebug(1), idevicediagnostics(1), idevicebackup2(1), idevicerestore(1)

Copied to clipboard