iOS模拟器运行时出现Pseudo Terminal Setup Error问题及修复咨询
Hey there, let's break down this error and get your app running in the iOS Simulator again. That Errno 6 corresponds to ENXIO—a system error meaning "No such device or address"—and it pops up when the Simulator fails to set up the pseudo terminal (pty) it uses to communicate with your app. This is almost always tied to temporary state issues, permission problems, or cached data. Here are the steps to fix it:
Fully restart Xcode and the Simulator
First, quit Xcode completely (pressCmd + Q), then open the Simulator and use the menu bar to selectSimulator > Quit Simulator(don't just close the window). Wait a few seconds, then launch both apps again. Temporary glitches in their runtime state often cause this error, and a fresh start clears it up.Reset Simulator Content & Settings
In the Simulator, go toDevice > Erase All Content and Settings. Confirm the action when prompted, and let the Simulator reset. This wipes out cached app data, preferences, and any corrupted terminal configurations that might be blocking the setup.Verify Xcode's System Permissions
Sometimes Xcode lacks the necessary access to system terminal devices. Head toSystem Settings > Privacy & Security > Full Disk Access, make sure Xcode is listed there and its toggle is enabled. If it's already on, toggle it off, wait 10 seconds, then toggle it back on. Restart Xcode after this change.Reboot your Mac
It sounds basic, but system-level device nodes for pseudo terminals can get stuck in a broken state. A full reboot resets these system resources, often resolving the underlying issue that's causing the pty setup to fail.Reinstall Xcode Command Line Tools
Open Terminal and runxcode-select --installto trigger a fresh install of the command line tools. If they're already installed, first reset the path withsudo xcode-select --reset, then run the install command again. These tools handle low-level terminal interactions that the Simulator relies on.Disable third-party terminal/ system tools temporarily
If you use tools like iTerm2 with custom plugins, tmux, or system optimization utilities, they might be modifying the terminal environment in a way that conflicts with the Simulator. Disable these tools temporarily, then try launching the Simulator again to see if the error goes away.
If none of the above steps work, a last resort is to uninstall and reinstall Xcode—but this should only be necessary if all other fixes fail.
内容的提问来源于stack exchange,提问作者user3151675

