# My macOS is always stuck when I operate Psychtoolbox

**URL:** <https://psychtoolbox.discourse.group/t/my-macos-is-always-stuck-when-i-operate-psychtoolbox/4140>\
**Category:** Programming Help\
**Tags:** macos\
**Created:** [November 25, 2021, 10:23am UTC](https://psychtoolbox.discourse.group/t/my-macos-is-always-stuck-when-i-operate-psychtoolbox/4140 "2021-11-25T10:23:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![liteng517](https://avatars.discourse-cdn.com/v4/letter/l/779978/32.png) [@liteng517](https://psychtoolbox.discourse.group/u/liteng517)\
**Post date:** [November 25, 2021, 10:23am UTC](https://psychtoolbox.discourse.group/t/my-macos-is-always-stuck-when-i-operate-psychtoolbox/4140/1 "2021-11-25T10:23:29Z")

</div>

My iMac’s system is the latest ---- Monterey 12.0.1  
My iMac is Retina 5K, 27-inch, 2017.  
And my Matlab is 2021a, Psychtoolbox is '‘3.0.18 - Flavor: beta - Corresponds to SVN Revision 12412’  
Here’s my problem: I’ve just begun to learn Psychtoolbox and I copy the very basic example shown on the official website (the code is as below)

 ![image](https://global.discourse-cdn.com/free1/uploads/psychtoolbox/original/1X/c998a3accc7ab2251efec01b217cd803364c3d69.png)  
When I operate this simple program the screen is stuck in a grey page and whatever I do I can’t cancel or exit it.  
I don’t know what’s going wrong. Maybe it’s the system bug because I can operate the same program on macOS big sur a few weeks ago.  
Hoping someone can solve my problem.

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [November 27, 2021, 4:36am UTC](https://psychtoolbox.discourse.group/t/my-macos-is-always-stuck-when-i-operate-psychtoolbox/4140/2 "2021-11-27T04:36:31Z")

</div>

macOS 12 is not officially supported or tested at all. Upgrading to a new macOS version without urgent need, given what a quality shit-show every single macOS release in the last decade was, is very brave.

Given that the script shows a grey screen, as requested, and other than that only waits for a key press, then exits, getting stuck on the grey screen suggests problems with keyboard input.

Does `KbStrokeWait` in the Matlab terminal work? If not, try the things posted in other threads wrt. broken macOS keyboard input.

Other than that, `help PsychPaidSupportAndServices` for any further advice or comments from myself.  
-mario

---

<div class="post-metadata">

**Author:** ![liteng517](https://avatars.discourse-cdn.com/v4/letter/l/779978/32.png) [@liteng517](https://psychtoolbox.discourse.group/u/liteng517)\
**Post date:** [November 27, 2021, 6:26am UTC](https://psychtoolbox.discourse.group/t/my-macos-is-always-stuck-when-i-operate-psychtoolbox/4140/3 "2021-11-27T06:26:02Z")

</div>

The KbStrokeWait doesn’t work but when I changed to the keyboard with wire, it works (I used wireless keyboard before). My problem has been solved yet. Thank you.

---

<div class="post-metadata">

**Author:** ![mariokleiner](https://avatars.discourse-cdn.com/v4/letter/m/13edae/32.png) [@mariokleiner](https://psychtoolbox.discourse.group/u/mariokleiner)\
**Post date:** [November 27, 2021, 5:32pm UTC](https://psychtoolbox.discourse.group/t/my-macos-is-always-stuck-when-i-operate-psychtoolbox/4140/4 "2021-11-27T17:32:37Z")

</div>

It queries the default keyboard, so if you have multiple keyboards connected, it will only query one of them. `KbStrokeWait(-1)` for all of them. `help KbStrokeWait` for more info.
