How can I get the console logs from the iOS Simulator?
You can view the console for the iOS Simulator via desktop Safari. It's similar to the way you use desktop Safari to view the console for physical iOS devices.
Whenever the simulator is running and there's a webpage open, there'll be an option under the Develop menu in desktop safari that lets you see the iOS simulator console:
Develop -> iPhone Simulator -> site name
There's an option in the Simulator to open the console
Debug > Open System Log
or use the keyboard shortcut: ⌘/
iOS 8 and iOS 9
Under iOS 8 and iOS 9 this location is now:
~/Library/Logs/CoreSimulator/<DEVICE_CODE>
So, the following will work:
tail -f ~/Library/Logs/CoreSimulator/<DEVICE_CODE>/system.log
The DEVICE_CODE
value can be found via the following terminal command:
instruments -s devices
iOS Simulator > Menu Bar > Debug > Open System Log
Old ways:
iOS Simulator prints its logs directly to stdout, so you can see the logs mixed up with system logs.
Open the Terminal and type: tail -f /var/log/system.log
Then run the simulator.
EDIT:
This stopped working on Mavericks/Xcode 5. Now you can access the simulator logs in its own folder: ~/Library/Logs/iOS Simulator/<sim-version>/system.log
You can either use the Console.app to see this, or just do a tail (iOS 7.0.3 64 bits for example):
tail -f ~/Library/Logs/iOS\ Simulator/7.0.3-64/system.log
EDIT 2:
They are now located in ~/Library/Logs/CoreSimulator/<simulator-hash>/system.log
tail -f ~/Library/Logs/CoreSimulator/<simulator-hash>/system.log