How to Compile the iOS Version
First setup the development environment.
Install Xcode from AppStore (Last tested 14.2)
Install Xcode command-line tools
$ xcode-select --install
Or in case of errors try to download and install it from Apple site: https://developer.apple.com/download/all/?q=xcode.
Log in into Xcode account (optional) In case if you don't have Apple Developer account. Open Xcode and go to preferences (via top menu)
Preferences -> Accounts
+button. You can log in with your AppleID (login and password from your iOS/macOS devices). Follow Xcode instructions. For OsmAnd team members: send your AppleID login, so you will be added to to developers list. When you'll get email with invite message activate it. Close Xcode.
Install command-line tools- cmake, svn, cocoapods
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
$ brew install svn
$ brew install cmake # tested on 3.25.2, 3.19, 3.11
# for intel
$ sudo gem install cocoapods
# for m1
$ brew install cocoapods
prepare.shto compile Qt library and download external dependencies
$ cd ios
Xcode not set up properly. You may need to confirm the license.... Solution: switch XcodeCommandLineTools to Xcode app, confirm the license and switch it back.
$ sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
$ sudo xcodebuild -license accept
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
Solution 2: check if xcrun is available:
/usr/bin/xcrun -find xcrun. If you've got:
xcrun: error: unable to find utility "xcrun", not a developer tool or in PATH. Then open Xcode > Preferences > Locations and in field "Command Line Tools" select your command line tools "Xcode XX.X" And run
Solution 3: If you've got error like this:
CMake Error at CMakeLists.txt:1 (cmake_minimum_required): CMake 3.21.2 or higher is required. You are running version 3.11.2. Then download dmg installer from CMake web site and perfom manual instalation. And run
Solution 4: If you've got error like this:
Failed to configure 'qtbase-ios' for 'ios.simulator.clang.static', aborting.... Go to folded
core/external/qtbase-ios/and delete all folders starting with
upstream. And run
First build. Set the build target to
OsmAnd Maps. (Near play/stop buttons). Select as target your device or as one of iOS simulators. But don't use default 'Any iOS Device (arm64)'. Build the project (play button).
- In case of build errors you can press in Xcode:
Product -> Clean build folder
- Close Xcode. Delete
OsmAnddirectory (if it already exists).
- Delete Xcode DerivedData folder:
rm -rf ~/Library/Developer/Xcode/DerivedData
- Check that all repositories are up to date and on correct branches.
- Restart your computer. (Yes, it can help).
- Then run
$ ./prepare.shand try to build the project again.
- Troubleshooting (m1 mac)
- In case of
ld: library not found for -lOsmAndCore_static_standalone:
- Project Navigator -> OsmAnd_projects -> OsmAnd_projects (in Project/Targets list) -> Build settings -> All -> Architectures -> Excluded Architectures -> Debug
- Add string field of type
Any IOS Simulator SDKwith value
arm64. (you will need to add it after each prepare.sh run)
- Build project. In case of errors, delete folders
- Debug Qt (optional). If you want to see Qt values in debug mode run this:After set this parameters reboot your computer.
$ mkdir -p ~/qtlldb
$ git clone https://github.com/gbooker/lldb-qt-formatters ~/qtlldb
$ touch ~/.lldbinit
$ echo "command script import ~/qtlldb/both.py" >> ~/.lldbinit