Error: Command failed: osascript -e tell app "System Events" to count processes whose name is "Simulator" (-1743)

after I run expo start

the web console open successfully, but the iOS simulator can't work as usual

Error installing or running app. Error: Command failed: osascript -e tell app "System Events" to count processes whose name is "Simulator" 28:69: execution error: 未獲授權傳送 Apple Event 給「System Events」。 (-1743)

How can I fix this?

React Native Environment Info: System: OS: macOS 10.14.3 CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz Memory: 38.77 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.1 - /usr/local/bin/node npm: 6.9.0 - ~/.npm-global/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.1, macOS 10.14, tvOS 12.1, watchOS 5.1 IDEs: Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: react: 16.5.0 => 16.5.0 react-native: https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz => 0.57.1 npmGlobalPackages: react-native-cli: 2.0.1


I used this link to help me figure it out: macOS Mojave, Automator “Not authorized to send Apple events to System Events.” 32

I went to

System Preferences > Security & Privacy > Automation > Privacy: and made sure 'System Events' was checked under xcode

There were others suggesting to restart my mac so that may help as well. Good luck!