With all my SDL/OpenGL programs, the framerate is stuck at 60fps, so looks like the vsync is enable, but not by me, nor in my code or my settings. so i would like to now if there is a way to disable it, maybe in some deep macOS settings?
3 Answers
This enabled me to get around ~700 frames per second on my MacBook Pro.
- Download Graphics Tools for Xcode - Late August 2014
- Install or just mount Graphic Tools
- Open Quartz Debug
- Go to Tools -> Show Beam Sync Tools
- Select Disable Beam Synchronization
It is not permanent either, perfect for testing/benchmarking.

- 5,671
- 2
- 49
- 34
-
1Oh my gad, after all that time!! Thanks so much mate! – Nox Oct 02 '14 at 01:50
-
i tried this and nothing happened. What am i doing wrong? – Kalamalka Kid Jun 04 '16 at 09:18
-
1. Double check that the app you are testing can actually go over 60fps; 2. This solution was for Mavericks 10.9, untested for Yosemite or El Capitan – cevaris Jun 04 '16 at 16:09
-
1Would you mind to state in your answer that this solution is actually not working on 10.11 with xCode 7.3 (that the only one I've tried) anymore please? – Nox Jul 13 '16 at 22:56
-
Your first link is broken: it says `Your session has expired. Please log in.`. – Ruslan Aug 12 '16 at 09:58
Welcome to SO. I outlined an approach here for a similar question. You should consider that most Mac LCDs are locked to 60Hz, and more recent hardware is limited to 120Hz. Disabling vsync may simply result in wasted CPU/GPU cycles, and possibly introduce tearing artifacts.

- 1
- 1

- 21,653
- 2
- 61
- 90
After YEARS looking for a workaround (and with the help of Brett Hale) this is what worked for me - I've added that piece of code at the start of my render loop (and not only in the init, as Apple seems to reset the SwapInterval settings every time...) and was finally able to have unsynchronize framerate:
#ifdef __APPLE__
GLint sync = 0;
CGLContextObj ctx = CGLGetCurrentContext();
CGLSetParameter(ctx, kCGLCPSwapInterval, &sync);
#endif
Don't forget to include <OpenGL/gl.h>
It's not the nicest solution but it's actually the only one I found that work like a charm.
-
Apparently this is broken in Mac OS 10.14 (Mojave), with vsync always disabled, (but vsync in Metal still works). SDL2.0.10+ (not yet released) will work around this bug by using CVDisplayLink instead. You can see the [commit here](https://hg.libsdl.org/SDL/rev/73f3ca85ac0e) and [discussion here](https://discourse.libsdl.org/t/sdl2-no-renderer-vsync-on-macos-mojave/25169/22) – Ralph Versteegen Mar 24 '19 at 00:42
-
Also, the code SDL2 were previously using only seems to set this once, not every frame. Maybe because they instead called `[NSOpenGLContext setValues:&value forParameter:NSOpenGLCPSwapInterval]` – Ralph Versteegen Mar 24 '19 at 00:46
-
News just in, [apparently OpenGL vsync is fixed in the next release](https://github.com/glfw/glfw/issues/1337), Mac OS 10.14.4 – Ralph Versteegen Mar 24 '19 at 00:49
-
Confirmed working on macOS 10.14, but seems this is not working on macOS 10.15 and 11 anymore, I've tried `kCGLCPSwapInterval` / `NSOpenGLCPSwapInterval` / `CVDisplayLink` – vk.edward.li Jul 24 '21 at 12:54
-
Found out on macOS 10.15 and 11, the actual drawing code including `flushBuffer()` must not be put in `func draw(_ dirtyRect: NSRect)` – vk.edward.li Jul 26 '21 at 14:16
-
May be a simple question, but where do I execute this code and how? I tried in in Terminal and I have Xcode. – Mustafa Iqbal Feb 02 '22 at 10:08
-
I followed the instructions here: https://www.reddit.com/r/applehelp/comments/5bb0db/how_to_unlock_the_fps_on_a_macosdisable_vsync/ with the above code however several errors were thrown. Scouring GitHub it seems there is a problem with disabling VSync in Mac OS 12.2. – Mustafa Iqbal Feb 02 '22 at 14:48
-
@MustafaIqbal this code goes inside your render loop when developing your app (I was using c++). Note that it will only affect your app, it's not a shared setting – Nox Feb 08 '22 at 22:04