Simulator error
FBSSystemServiceDomain
code 4
troubleshooting
iOS development

Simulator error FBSSystemServiceDomain code 4

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

FBSSystemServiceDomain code 4 usually appears when Xcode cannot launch or attach to your app inside the iOS Simulator. The message looks low-level, but most of the time the problem is stale simulator state, a broken runtime, or a mismatch between the selected destination and what the build actually supports.

What the Error Usually Means

The FBS prefix refers to FrontBoard Services, which is part of the app lifecycle machinery on Apple platforms. When the simulator reports code 4, it is generally failing before your app logic has a chance to run. That is why the fix is rarely in your Swift or Objective-C code.

Treat this as an environment problem first. Check these three categories in order:

  1. simulator state
  2. Xcode build products
  3. runtime and deployment compatibility

Starting with app code is usually wasted effort.

Reset the Simulator Cleanly

The fastest way to rule out corrupted simulator state is to shut down all simulators and clear their data. These commands are safe for the simulator installation, but erase all deletes simulator app data, so use it knowingly.

bash
1xcrun simctl shutdown all
2xcrun simctl erase all
3xcrun simctl delete unavailable
4open -a Simulator

If the problem only happens on one device, inspect the installed runtimes before erasing everything:

bash
xcrun simctl list devices
xcrun simctl list runtimes

Look for devices that are unavailable, duplicated, or tied to runtimes that are no longer installed. A stale device record can be enough to trigger launch failures.

Clean Xcode Build State

If the simulator itself looks healthy, clean the build side next. Old build products and stale DerivedData regularly cause launch errors that look like simulator bugs.

bash
rm -rf ~/Library/Developer/Xcode/DerivedData
xcode-select -p
xcodebuild -showsdks

After removing DerivedData, reopen Xcode and build again. The xcode-select -p check matters when you have multiple Xcode versions installed. If command-line tools point at one Xcode while the GUI uses another, simulator runtimes and build products can get out of sync.

A good sanity check is to confirm that the selected simulator runtime is at least as new as your app deployment target. If the app targets a newer iOS version than the installed simulator runtime supports, launch can fail with misleading service errors.

Check Project and Destination Compatibility

This error also appears when the selected destination is wrong for the build. Common examples are:

  • building for an old simulator runtime after upgrading Xcode
  • using an app extension or framework that is not compatible with the chosen simulator architecture
  • signing or bundle-identifier issues that stop the install step before launch

You can inspect the destination from the command line with a targeted build:

bash
1xcodebuild \
2  -scheme MyApp \
3  -destination 'platform=iOS Simulator,name=iPhone 16' \
4  build

If this command fails before launch, the output is often clearer than the short popup in Xcode. In particular, watch for architecture complaints, missing simulator runtimes, or bundle install errors.

When Reinstalling the Runtime Helps

Sometimes the runtime itself is damaged. This is more likely after an interrupted Xcode update or when you switch between beta and stable Xcode versions. In that case, removing the affected simulator runtime from Xcode settings and reinstalling it is often faster than chasing secondary symptoms.

If you recently changed Xcode versions, also restart the simulator service by rebooting the Mac or relaunching Xcode after all simulators are shut down. That clears a surprising number of one-off FrontBoard errors.

Common Pitfalls

The most common mistake is assuming code 4 points to one specific bug. It does not. It is a symptom that the launch pipeline broke somewhere below your app.

Another mistake is erasing simulators before checking whether the wrong Xcode is selected. If xcode-select points at an older installation, the problem will come back immediately.

Developers also lose time by testing only from the Xcode play button. Running one xcodebuild command against a named simulator often exposes the real error message faster.

Summary

  • 'FBSSystemServiceDomain code 4 is usually a simulator or Xcode environment issue, not an app logic bug.'
  • Start by resetting simulator state with simctl, then clean DerivedData.
  • Verify that xcode-select, installed SDKs, and simulator runtimes all line up.
  • Confirm the selected simulator destination is compatible with your deployment target and architecture.
  • If the issue survives cleanup, reinstall the affected simulator runtime or switch to a known-good Xcode version.

Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.