MacBook M2 Pro : Running Psychtoolbox on it

Hi everyone

I’m trying to run a script on MATLAB (the latest version as of 23/11/2023) but im getting the following error:

>> testt

ans =


PTB-WARNING: This is a Apple silicon based ARM M1 SoC or later with Apple proprietary gpu.
PTB-WARNING: All of Psychtoolbox own timing and timestamping mechanisms will not work on
PTB-WARNING: such a machine, leading to disastrously bad visual stimulus presentation timing
PTB-WARNING: and timestamping. Do not trust or use this machine if timing is of any concern!
PTB-WARNING: You may want to try enabling Psychtoolbox Vulkan display backend, after proper
PTB-WARNING: configuration. See 'help PsychImaging' the section about the 'UseVulkanDisplay'
PTB-WARNING: task, and 'help PsychHDR' for some more setup instructions for MoltenVK on macOS.
PTB-WARNING: Note that this approach is completely unsupported by us in case of any problems, and
PTB-WARNING: may just be as bad performance and timing-wise. It is completely untested on M1.
PTB-WARNING: A simple test case would be running SimpleHDRDemo. If it wouldn't flood the command
PTB-WARNING: window with error and warning messages, that would be mildly encouraging. Let us know.

PTB-INFO: Retina display. Enabling panel fitter for scaled Retina compatibility mode.

PTB-INFO: This is Psychtoolbox-3 for Apple macOS, under Matlab 64-Bit (Version 3.0.19 - Build date: Oct 25 2023).
PTB-INFO: OS support status: macOS version 13 ARM M1+ SoC is not yet tested or supported at all for this Psychtoolbox release..
PTB-INFO: Type 'PsychtoolboxVersion' for more detailed version information.
PTB-INFO: Most parts of the Psychtoolbox distribution are licensed to you under terms of the MIT License, with
PTB-INFO: some restrictions. See file 'License.txt' in the Psychtoolbox root folder for the exact licensing conditions.

PTB-INFO: For information about paid support, support memberships and other commercial services, please type
PTB-INFO: 'PsychPaidSupportAndServices'.

PTB-INFO: Using Cocoa + No display capture / compositor lockout for fullscreen window. Timing will be disastrous.
PTB-INFO: Installation of the PsychtoolboxKernelDriver is strongly recommended if you care about precise visual
PTB-INFO: onset timestamping or timing. See 'help PsychtoolboxKernelDriver' for installation instructions.

PTB-INFO: OpenGL-Renderer is Apple :: Apple M2 Pro :: 2.1 Metal - 83.1
PTB-INFO: Renderer has 10922 MB of VRAM and a maximum 10922 MB of texture memory.
PTB-INFO: VBL startline = 1490 , VBL Endline = -1
PTB-INFO: Beamposition queries unsupported or defective on this system. Using basic timestamping as fallback.
PTB-INFO: Timestamps returned by Screen('Flip') will be therefore less robust and accurate.
PTB-INFO: Measured monitor refresh interval from VBLsync = 0.000000 ms [inf Hz]. (0 valid samples taken, stddev=0.000000 ms.)
PTB-INFO: Reported monitor refresh interval from operating system = 8.333333 ms [120.000000 Hz].
PTB-INFO: Small deviations between reported values are normal and no reason to worry.
PTB-INFO: All display tests and calibrations disabled. Assuming a refresh interval of 120.000000 Hz. Timing will be inaccurate!
PTB-INFO: Psychtoolbox imaging pipeline starting up for window with requested imagingmode 33793 ...
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus drawing.
PTB-INFO: Enabling panel fitter. Providing virtual framebuffer of 1147 x 745 pixels size.
PTB-INFO: Will use 8 bits per color component framebuffer for stimulus post-processing (if any).
PTB-WARNING: DrawText: Failed to load external drawtext plugin [dlopen(/Applications/Psychtoolbox/PsychBasic/PsychPlugins/libptbdrawtext_ftgl64.dylib, 0x000A): Library not loaded: /Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libfontconfig.1.dylib
  Referenced from: <196C96CD-AE88-31D3-B735-C650101C3062> /Applications/Psychtoolbox/PsychBasic/PsychPlugins/libptbdrawtext_ftgl64.dylib
  Reason: tried: '/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libfontconfig.1.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libfontconfig.1.dylib' (no such file), '/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libfontconfig.1.dylib' (no such file), '/usr/local/lib/libfontconfig.1.dylib' (no such file), '/usr/lib/libfontconfig.1.dylib' (no such file, not in dyld cache)]. Retrying under generic name [libptbdrawtext_ftgl64.dylib].
PTB-WARNING: DrawText: Failed to load external drawtext plugin 'libptbdrawtext_ftgl64.dylib' [dlopen(libptbdrawtext_ftgl64.dylib, 0x000A): tried: 'libptbdrawtext_ftgl64.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OSlibptbdrawtext_ftgl64.dylib' (no such file), '/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libptbdrawtext_ftgl64.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libptbdrawtext_ftgl64.dylib' (no such file), '/Applications/' (no such file), '/Applications/' (no such file), '/Applications/' (no such file), '/Applications/' (no such file), '/Applications/' (no such file), '/usr/lib/libptbdrawtext_ftgl64.dylib' (no such file, not in dyld cache), 'libptbdrawtext_ftgl64.dylib' (no such file), '/usr/local/lib/libptbdrawtext_ftgl64.dylib' (no such file), '/usr/lib/libptbdrawtext_ftgl64.dylib' (no such file, not in dyld cache)]. Reverting to legacy text renderer.
PTB-WARNING: DrawText: Functionality of Screen('DrawText') and Screen('TextBounds') may be limited and text quality may be impaired.
PTB-WARNING: DrawText: Type 'help DrawTextPlugin' at the command prompt to receive instructions for troubleshooting.

PsychHID-ERROR: During PsychHID invocation: macOS is preventing access to HID input devices like keyboard, keypad and mouse!
PsychHID-ERROR: This is because permission for 'Input Monitoring' is denied to Matlab 64-Bit, or to, if you started Matlab 64-Bit from a Terminal.
PsychHID-ERROR: Please rectify this manually now:
PsychHID-ERROR: 1. Quit Matlab 64-Bit, and also Terminal if it was used to launch Matlab 64-Bit.
PsychHID-ERROR: 2. Open 'System Preferences', then go to the 'Security & Privacy' control panel.
PsychHID-ERROR: 3. Select the 'Privacy' tab, and then in the list on the left, the item 'Input Monitoring'.
PsychHID-ERROR: 4. Make sure that Matlab 64-Bit, or similar, or maybe Terminal instead, is listed in the list on the right.
PsychHID-ERROR:    E.g., names could be 'Terminal' or 'Octave' something, or '' or similar for Matlab.
PsychHID-ERROR: 5. Make sure that the checkbox next to the name of the item is checked.
PsychHID-ERROR: 6. Restart Matlab 64-Bit.
PsychHID-ERROR: 7. Execute the 'KbCheck' command as a simple test, which should hopefully work now without errors.
PsychHID-ERROR: 8. If it doesn't work, go back to step 5, but *uncheck* the checkbox, close the GUI,
PsychHID-ERROR:    then reopen the GUI, go back to step 5 and *check* the checkbox again. Unchecking
PsychHID-ERROR:    and then checking the checkbox again, and closing and reopening the security GUI and
PsychHID-ERROR:    Matlab/Octave/Terminal inbetween usually fixes these issues caused by Apple macOS GUI bugs.
PsychHID-ERROR:    It may also be neccessary to delete the item from the list by marking it and then using the
PsychHID-ERROR:    - (Minus) button at the bottom of the list view. Closing the GUI, reopening and readding the
PsychHID-ERROR:    Matlab/Octave/Terminal item to the list by clicking the + (Plus) button.
PsychHID-ERROR: 9. If it still doesn't work, retry the procedure - rinse, wash, repeat.
PsychHID-ERROR: 10. If it works without errors, retry if your own scripts or our demos now work again.
PsychHID-ERROR: 11. If none of this works, you may be able to buy paid support from us: 'help PsychPaidSupportAndServices'.

Error in function : 	Usage error
PsychHID-CRITICAL: PsychHID disabled due to macOS security restrictions! Emergency shutdown! 'clear all' or restart your application.

WARNING: This session of your experiment was run by you with the setting Screen('Preference', 'SkipSyncTests', 2).
WARNING: This means that some internal self-tests and calibrations were skipped. Your stimulus presentation timing
WARNING: may have been wrong. This is fine for development and debugging of your experiment, but for running the real
WARNING: study, please make sure to set Screen('Preference', 'SkipSyncTests', 0) for maximum accuracy and reliability.
PTB-CRITICAL: Recursion stack underflow in module PsychHID! Brace for impact!
Unable to resolve the name 'psychlasterror.message'.

Error in testt (line 75)
    fprintf('Error: %s\n', psychlasterror.message);

The script that i’m using is as follows:

Screen('Preference', 'SkipSyncTests', 0)
% Psychtoolbox Experiment - Basic Emotional vs Neutral Word Recognition

    % Setup PTB with some default values

    % Skip sync tests for demo purposes (not recommended for real experiments)
    Screen('Preference', 'SkipSyncTests', 2);

    % Open a graphics window on the main screen
    screenNumber = max(Screen('Screens'));
    [window, windowRect] = PsychImaging('OpenWindow', screenNumber, 0);

    % Define colors
    white = WhiteIndex(screenNumber);
    black = BlackIndex(screenNumber);

    % Set text font and size
    Screen('TextFont', window, 'Arial');
    Screen('TextSize', window, 24);

    % Prepare the sequence of words (example words)
    words = {'Happy', 'Sad', 'Table', 'Angry', 'Chair', 'Joyful', 'Pencil', 'Fear', 'NeutralWord'};
    % Define the target word
    targetWord = 'Joyful';

    % Randomize word order
    shuffledIndices = Shuffle(1:length(words));
    words = words(shuffledIndices);

    % Instructions
    DrawFormattedText(window, 'Press any key when you see the word "Joyful". \n Press Enter to begin.', 'center', 'center', white);
    Screen('Flip', window);

    % Main experiment loop
    for i = 1:length(words)
        % Draw word
        DrawFormattedText(window, words{i}, 'center', 'center', white);

        % Flip to the screen
        Screen('Flip', window);

        % Wait for response or 2 seconds
        startTime = GetSecs;
        while GetSecs - startTime < 2
            [keyIsDown, ~, keyCode] = KbCheck;
            if keyIsDown
                if strcmp(KbName(keyCode), targetWord)
                    % Correct response
                    % You would record the response time here
                    % Wrong response or other key pressed
                    % Handle accordingly

        % Short blank screen between words
        Screen('FillRect', window, black);
        Screen('Flip', window);

    % Close the screen

    % Close the screen and show error message
    fprintf('Error: %s\n', psychlasterror.message);

Can someone please help me with this? I am really new to this and have a deadline on the 26th. Some help would be really useful!
Thank you!

The steps to follow for fixing this are literally in the error
message. Follow them

1 Like

Hi there! I am sorry, I do not know the answer to your question. I do want to ask though were you able to full download psychtoolbox on your Mac m2 pro? I am having an error that suggests I am downloading a 64 bit version of psychtoolbox on a 32 bit version of matlab. When indeed I am on a 64 bit matlab. Did you have any errors during installation?

1 Like