Home > database >  Executing `flutter run` on a remote machine makes xcodebuild fail
Executing `flutter run` on a remote machine makes xcodebuild fail

Time:06-11

I am connected to a mac via ssh and physically connected an iPhone to it. Now I wanted to run flutter run on that mac to test my app on the iPhone.

When logging in graphically on the mac, flutter run executes without a problem.

But over ssh, flutter run fails in the xcodebuild stage. It produces a generic error message

Error output from Xcode build:
2022-06-07 08:39:37.623 xcodebuild[6002:21187] XType: com.apple.fonts is not accessible.
2022-06-07 08:39:37.623 xcodebuild[6002:21187] XType: XTFontStaticRegistry is enabled.
** BUILD FAILED **

Xcode's output:
Command PhaseScriptExecution failed with a nonzero exit code

I was able to gather the following error message via flutter run --verbose

Target debug_ios_bundle_flutter_assets failed: Exception: Failed to codesign
<project_folder>/build/ios/Debug-iphoneos/App.framework/App: errSecInternalComponent

What is going on?

Why does the build fail when logged in over ssh?

CodePudding user response:

As it turns out, xcodebuild required access to an item that has been stored in the login keychain. When graphically logging in on the mac, the keychain has been automatically unlocked. But when only logged in over ssh, the keychain remains locked.

The keychain can be unlocked via the following command

security unlock-keychain login.keychain  

Afterwards, flutter run succeeds

  • Related