The current version of PsychoPy runs on Apple Silicon (e.g. M1, M2, and later) Macs through Rosetta 2. Below are instructions to run a native Apple Silicon (arm64) version of PsychoPy.
Install brew to install various apps needed for PsychoPy.
brew install [email protected]
Python 3.10.16 (3 Dec 2024).
git clone https://github.com/waltervanheuven/psychopy-on-M1.git
cd psychopy-on-M1
python3.10 -m venv venv
# activate venv
source venv/bin/activate
# update pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel
psychtoolbox version: 3.0.20.1
# This fails
pip install git+https://github.com/Psychtoolbox-3/[email protected]
Error:
./PsychSourceGL/Source/Common/Base/PsychLM.c:66:9: warning: unknown pragma ignored [-Wunknown-pragmas]
66 | #pragma comment(lib, "../../../LexActivator.lib")
| ^
./PsychSourceGL/Source/Common/Base/PsychLM.c:72:10: fatal error: '../../../../../LexActivator.h' file not found
72 | #include "../../../../../LexActivator.h"
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
To fix this error, download Psychotoolbox-3 version 3.0.20.1
and clone repository:
cd tmp
wget https://github.com/Psychtoolbox-3/Psychtoolbox-3/archive/refs/tags/3.0.20.1.zip
unzip 3.0.20.1.zip
git clone https://github.com/cryptlex/lexactivator-c.git
# copy missing files to folder above Psychtoolbox-3
cd lexactivator-c/examples
cp LexActivator.h ../../
cp LexStatusCodes.h ../../
cp LexTypes.h ../../
# build Psychtoolbox
cd ../../Psychtoolbox-3-3.0.20.1
python3 -m pip install .
# note that the version number of Psychtoolbox still indicates 3.0.20.0
brew install ffmpeg
Using PsychoPy source.
mkdir tmp
cd tmp
wget https://github.com/psychopy/psychopy/archive/refs/tags/2024.2.5.zip
unzip 2024.2.5.zip
# replace pyproject.toml with amended version in this repository:
# changes:
# - disabled psychtoolbox because already installed in venv
# - changed wxPython to version 4.2.1 because with version 4.2.2 PsychoPy doesn't work
cd ..
cp pyproject.toml tmp/psychopy-2024.2.5/
cd tmp/psychopy-2024.2.5
python3 -m pip install .
cd ../..
psychopy
Please note that PsychoPy fails to start without any error message appearing in the Terminal when Secure Keyboard Entry
is enabled in the Terminal. Make sure this is turned off
.
- Psychtoolbox (PTB) import issue
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/_____/psychopy-on-M1/venv/lib/python3.10/site-packages/psychtoolbox/__init__.py", line 26, in <module>
from .WaitSecs import WaitSecs
ImportError: dlopen(/Users/____/psychopy-on-M1/venv/lib/python3.10/site-packages/psychtoolbox/WaitSecs.cpython-310-darwin.so, 0x0002): symbol not found in flat namespace '_ActivateLicense'
Solution so that builder project run:
Switch Audio libray in the Properties to sounddevice
.
-
Microphone component is not working
Microphone component fails because Psychtoolbox import fails.
-
If
timeByFramesEx.py
fails to run, change line 34 tomatplotlib.use('QtAgg')
.Note that there is vsync OpenGL bug in macOS Ventura/Sonoma so vsync doesn't work correctly.
-
Tobii library is now support on Apple silicon!
pip install tobii-research
-
PsychoPy fails to start again after exiting PsychoPy
Issue might be due to sandboxing. Fix this by installing the Intel (Rosetta 2) version of PsychoPy 2024.2.1 and starting this up once before trying again the Apple Silicon version.
If this still fails, uncheck "Secure Keyboard Entry" in the Terminal / iTerm2.
-
Unable to revert mtime: /Library/Fonts
errorFix this by installing
libmagic
.brew install libmagic
-
Drivers for Apple Silicon Macs
- USB driver for Cedrus response box/Stimtracker (ARM) download D2XX direct driver
-
Error when creating wheels (e.g. gevent)
Could be an issue with a beta version of xcode tools installed on your Mac. Revert back to latest (non-beta) version.
sudo rm -rf /Library/Developer/CommandLineTools xcode-select --install
-
Other issues
For other issues it might help to clear the pip cache.
pip cache purge
If PsychoPy fails to start up after you have changed the preferences, remove the file userPrefs.cfg
.
rm ~/.psychopy3/userPrefs.cfg
Benchmark wizard report (14" M1 Max MacBook Pro, macOS 15.3).
Previous version results:
PsychoPy | ||
PsychoPy | 2024.2.5 | |
locale | None.UTF-8 | |
python version | 3.10.16 (64bit) | |
wx | 4.2.1 osx-cocoa (phoenix) wxWidgets 3.2.2.1 | |
pyglet | 1.5.27 | |
rush | True | |
Visual | ||
openGL version | 2.1 Metal 89.3 | |
openGL vendor | Apple | |
screen size | 3024 x 1964 | |
have shaders | True | |
visual sync (refresh) | 7.10 ms | 1 |
refresh stability (SD) | 5.18 ms | 1 |
dropped frames | 71 / 181 | 1 |
openGL max vertices | 1048575 | |
GL_ARB_multitexture | True | |
GL_EXT_framebuffer_object | True | |
GL_ARB_fragment_program | True | |
GL_ARB_shader_objects | True | |
GL_ARB_vertex_shader | True | |
GL_ARB_texture_float | True | |
GL_ARB_texture_non_power_of_two | True | |
Numeric | ||
numpy | 1.26.4 | |
scipy | 1.15.1 | |
matplotlib | 3.10.0 | |
System | ||
platform | darwin 15.3 arm64 | |
CPU speed test | 0.001 s |
1
There is a vsync OpenGL issue on macOS Ventura/Sonoma/Sequoia.
Result of running timeByFramesEx.py
(60Hz LCD screen of M1 MacBook Pro, expected mean = 16.67 ms):
Note that vsync is working fine with PsychoPy in macOS Monterey 12.6.X (no dropped frames and stable vsync). Furthermore, you can run macOS virtualized using VirtualBuddy on Apple Silicon. Running a virtualized macOS works very well and the frame rate in PsychoPy is then stable.