Unable to install on Apple Silicon Macs through Matlab Add-on

It’s my first time to download PTB.
I’m using Apple M2 (Sonoma 14.0) and Matlab2024b (Silicon/ARM version).
I installed Gstreamer 1.24.10 runtime installer.
After watching Celia’s video, I downloaded and installed PTB-3 through the Matlab add-on. However, the Screen() failed to work when I ran SetupPsychtoolbox.

And when I ran Screen('Preference', 'SkipSyncTests', 1);

I got the following error:

Invalid MEX-file '/Users/username/Library/Application Support/MathWorks/MATLAB
Add-Ons/Collections/Psychtoolbox-3/Psychtoolbox/PsychBasic/Screen.mexmaca64':
dlopen(/Users/subaozi/Library/Application Support/MathWorks/MATLAB
Add-Ons/Collections/Psychtoolbox-3/Psychtoolbox/PsychBasic/Screen.mexmaca64, 0x0006): Library not
loaded: @rpath/libLexActivator.dylib
  Referenced from: <FC3FD20F-B39D-3708-B81F-C2CA69017697> /Users/subaozi/Library/Application
  Support/MathWorks/MATLAB Add-Ons/Collections/Psychtoolbox-3/Psychtoolbox/PsychBasic/Screen.mexmaca64
  Reason: tried: '/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib'
  (no such file),
  '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib'
  (no such file), '/Users/username/Library/Application Support/MathWorks/MATLAB
  Add-Ons/Collections/Psychtoolbox-3/Psychtoolbox/PsychBasic/PsychPlugins/libLexActivator.dylib' (no
  such file), '/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib' (no
  such file),
  '/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib'
  (no such file), '/Users/username/Library/Application Support/MathWorks/MATLAB
  Add-Ons/Collections/Psychtoolbox-3/Psychtoolbox/PsychBasic/PsychPlugins/libLexActivator.dylib' (no
  such file), '/Applications/MATLAB_R2024b.app/bin/maca64/libLexActivator.dylib' (no such file),
  '/Applications/MATLAB_R2024b.app/bin/maca64/./libLexActivator.dylib' (no such file),
  '/Applications/MATLAB_R2024b.app/bin/maca64/../../sys/os/maca64/libLexActivator.dylib' (no such
  file), '/Applications/MATLAB_R2024b.app/bin/maca64/libLexActivator.dylib' (no such file),
  '/Applications/MATLAB_R2024b.app/bin/maca64/./libLexActivator.dylib' (no such file),
  '/Applications/MATLAB_R2024b.app/bin/maca64/../../sys/os/maca64/libLexActivator.dylib' (no such
  file), '/Applications/MATLAB_R2024b.app/bin/maca64/../../runtime/maca64/libLexActivator.dylib' (no
  such file),
  '/Applications/MATLAB_R2024b.app/bin/maca64/../../sys/java/jre/maca64/jre/lib/server/libLexActivator.dylib'
  (no such file),
'/Applications/MATLAB_R2024b.app/bin/maca64/../../sys/java/jre/maca64/jre/lib/libLexActivator.dylib'
  (no such file)

I could not find the library (libLexActivator.dylib) and do not know whether I need to download it, and if yes, where to download it.

Just install via the instructions on the website.

My understanding is that the Matlab toolbox add-on route is broken due to the way in which it incorrectly setup the order of the installed files. Thus to be avoided.

I assume this is still the case as this route is no-longer stated on the website.

Peter

same issue, same error. i want to find the libLexActivator.dylib file but cant find it online. please update here if you figured this issue out

edit: i realized there is this downloadlexactivator.m in the psychtoolbox folder and i run it. it downloaded mac, linux and windows folders including the libLexActivator.dylib unzip the mac one, then if you set up psychtoolbox it runs. however psychtoolbox setup gave me a 30 day trial (don’t know why) should be free. another issue is the demos don’t work but my experiment code works fine

Please provide more information:

(1) Have you dowloaded in via the website and not as the Matlab toolbox file as per previous response? You do not say.
(2) Have you followed the installation instructions step by step?
(3) You will need to post some kind of error information: “the demos don’t work but my experiment code works fine” is not sufficient.
(4) PTB for macOS and Windows going forward will be a yearly subscription. This is due to the community not supporting PTB through the donation scheme (over many many years). There are a few threads on the forum about this.

P

What Peter says. Simply downloading and unzipping the 3.0.20.0.zip file, exactly as described in our download and installation instructions, consenting to license management, will give a functional PTB. So far we have 96 successful trial activations on macOS and Windows, so I know the workflow works.

The installation method via Matlabs Add-On manager remains broken. I removed the .mltbx files in the hope this would prevent people from installing a broken installation, but unfortunately the Add-On manager “outsmarted” me: It downloads the source code zip file instead, which misses the license manager components and is therefore dysfunctional - unless you run that downloadlexactivator(0,1) function as an extra and not yet officially supported step. After that you may still end with a broken installation depending on OS, as Matlabs Add-On manager just applies the same brokeness wrt. path setup that it did before, no way to stop it from doing that. “Strong work” by Mathworks.

See https://youtu.be/05gpkP_EMoc for further background info about the reasons for the new paid model.

Thank you for your detailed response. However, after downloading the zip file and running SetupPsychtoolbox in the Psychtoolbox folder, I got the following warning:

Warning: Software licensing setup failed for some reason. This may end badly soon... 
> In PsychtoolboxPostInstallRoutine (line 656)
In SetupPsychtoolbox (line 249)

The screen also failed to work due to the same error (Library not loaded: @rpath/libLexActivator.dylib)

Same error here. I downloaded and unzipped the 3.0.20.0 zip file, ran the SetupPsychtoolbox() command, but I didn’t see the processing of consenting to the license management.

Warning: Software licensing setup failed for some reason. This may end badly
soon…

In PsychtoolboxPostInstallRoutine (line 656)
In SetupPsychtoolbox (line 249)

A very simple test call to the Screen() MEX file failed in AssertOpenGL.
Either Screen is totally dysfunctional, or you are trying to run your script on
a system without Psychtoolbox-3 properly installed - or not installed at all.

Screen() does not work. Read all preceeding and following output as well as “help AssertOpenGL” for more info.
A first diagnostic test would be to simply type ‘Screen’ in your Matlab/Octave console and check what its output is.

The returned error message by Matlab/Octave was:
Last Error: Invalid MEX-file ‘/Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/PsychBasic/Screen.mexmaci64’: dlopen(/Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/PsychBasic/Screen.mexmaci64, 0x0006): Library not loaded: @rpath/libLexActivator.dylib
Referenced from: <97488582-708C-36E7-9F24-AECBD3E0C8DF> /Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/PsychBasic/Screen.mexmaci64
Reason: tried: ‘/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file), ‘/Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/PsychBasic/PsychPlugins/libLexActivator.dylib’ (no such file), ‘/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file), ‘/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file), ‘/Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/PsychBasic/PsychPlugins/libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/bin/maci64/libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/bin/maci64/./libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/bin/maci64/…/…/sys/os/maci64/libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/Contents/MacOS/libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/Contents/MacOS/./libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/Contents/MacOS/…/…/standalone/bin/maci64/libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/Contents/MacOS/…/…/sys/os/maci64/libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/bin/maci64/libLexActivator.dylib’ (no such file), ‘/usr/local/lib/libLexActivator.dylib’ (no such file), ‘/usr/lib/libLexActivator.dylib’ (no such file, not in dyld cache) (MATLAB:mex:ErrInvalidMEXFile)
/Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/PsychOneliners/AssertOpenGL.m,107
/Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/PsychtoolboxPostInstallRoutine.m,711
/Users/ruyuan/Documents/Code_matlabPath/Psychtoolbox-3-3.0.20.0/Psychtoolbox/SetupPsychtoolbox.m,249

NOTE: You may want to acquire paid support for future issues like this.
Please type ‘PsychPaidSupportAndServices’ to learn more.

maxBook Pro, Intel Iris Plus Graphics 1536 MB, 15.1.1 (24B91)

Did you download the top-most zip file on the releases page, that just says 3.0.20.0.zip as recommended, with the little cube box icon to the left of it? Iow. this linked file:
https://github.com/Psychtoolbox-3/Psychtoolbox-3/releases/download/3.0.20.0/3.0.20.0.zip

The links below, which say “Source code”, are the wrong ones and won’t work out of the box.

me too. followed installation instructions exactly AFAIK.

Invalid MEX-file ‘/Applications/Psychtoolbox/PsychBasic/Screen.mexmaca64’: dlopen(/Applications/Psychtoolbox/PsychBasic/Screen.mexmaca64, 0x0006): Library
not loaded: @rpath/libLexActivator.dylib
Referenced from: /Applications/Psychtoolbox/PsychBasic/Screen.mexmaca64
Reason: tried: ‘/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file),
‘/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file),
‘/Applications/Psychtoolbox/PsychBasic/PsychPlugins/libLexActivator.dylib’ (no such file),
‘/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file),
‘/System/Volumes/Preboot/Cryptexes/OS/Library/Frameworks/GStreamer.framework/Versions/Current/lib/libLexActivator.dylib’ (no such file),
‘/Applications/Psychtoolbox/PsychBasic/PsychPlugins/libLexActivator.dylib’ (no such file),
‘/Applications/MATLAB_R2024b.app/bin/maca64/libLexActivator.dylib’ (no such file), ‘/Applications/MATLAB_R2024b.app/bin/maca64/./libLexActivator.dylib’ (no
such file), ‘/Applications/MATLAB_R2024b.app/bin/maca64/…/…/sys/os/maca64/libLexActivator.dylib’ (no such file),
‘/Applications/MATLAB_R2024b.app/Contents/MacOS/libLexActivator.dylib’ (no such file),
‘/Applications/MATLAB_R2024b.app/Contents/MacOS/./libLexActivator.dylib’ (no such file),
‘/Applications/MATLAB_R2024b.app/Contents/MacOS/…/…/standalone/bin/maca64/libLexActivator.dylib’ (no such file),
‘/Applications/MATLAB_R2024b.app/Contents/MacOS/…/…/sys/os/maca64/libLexActivator.dylib’ (no such file),
‘/Applications/MATLAB_R2024b.app/bin/maca64/libLexActivator.dylib’ (no such file)

‘/Applications/Psychtoolbox/PsychBasic/PsychPlugins/libLexActivator.dylib’ (no such file) → This required dylib is missing. So far every single failure was caused by that dylib missing, because the wrong zip file was downloaded. Are you sure the zip file was the linked one below?

https://github.com/Psychtoolbox-3/Psychtoolbox-3/releases/download/3.0.20.1/3.0.20.1.zip

The right one expands into a single Psychtoolbox/ folder with the usual subfolders, and contains that libLexActivator.dylib file.

Hi Mario. Thanks. That zipped file expanded into a single Psychtoolbox folder. It worked. (The one I’d previously downloaded expanded into Psychtoolbox-3-3.0.20.1.) However, it did give me something of a start when I read “Your free trial is active for 5 more days, until Mon Jan 27 17:29:55 2025. After that date, you will have to buy a license to continue using Psychtoolbox on this machine.” I have – at present – no research funding. I guess I’ll need to revert to a legacy version.

Do you still have an active support membership? I think you used to have one?

active membership: no. yes, i used to have one.

then it will be sticking to completely unsupported legacy versions for the time being. Except for the Linux variant of 3.0.20, which will remain free of cost for the time being in the most popular combinations.

ok. NB: Linux remains verboten on all university machines here.