The Struggle Of Installing Vulkan / GLFW / GLM on MacOS Big Sur

I’m not going to lie getting Vulkan to work on MacOS Big Sur is a pain and now after a couple of weeks of trying I’ve finally got it working and I can now present to you a window. Fair point creating this window isn’t Vulkan – it’s actually GLFW (but the command line proves Vulkan has loaded).

And now for the command line which shows Vulkan has loaded some extensions:

You’ve probably noticed I use Visual Studio Code with the command line – I find XCode is too large an application and acts as barrier to doing anything else and I couldn’t get it to work with Vulkan.

How Did I Do It?

Step 1 – Install Visual Studio Code
You can download it for free from here.

Step 2 – Install Valkan
Download and run the MacOS Vaulkan SDK dmg. Open this and you’ll get a finder window, copy these files into a folder in your documents.

Open a terminal and navigate to the folder where the Vulkan SDK is installed – run the following command in the terminal:

sudo ./

It will ask you for your password and will then install the Vulkan files into the correct location.

Step 3 – Install GLFW.
Many guides recommend using homebrew but for one reason or another this refused to work for me (I suspect this is partly as Homebrew has changed where it installs files). The way I did it was to download GLFW from the official website and copy the files into a folder in Documents then back in the terminal navigate to this folder then run the following:

mkdir build
cd build
cmake ../
make && sudo make install

Step 4 – Install GLM
Again many guides recommend Homebrew but not me! I downloaded this from the github, copied the files into a folder in Documents, navigated to the folder in the terminal and then ran the following:

mkdir build
cd build
cmake ../
make && sudo make install

Step 5 – Create the Makefile
Enter the following into Visual Code Studio and save as Makefile:

CFLAGS = -std=c++17 -I.
LDFLAGS = pkg-config --cflags glfw3 pkg-config --static --libs glfw3 -lvulkan

a.out: main.cpp
g++ $(CFLAGS) -o a.out main.cpp $(LDFLAGS)

.PHONY: test clean

test: a.out

rm -f a.out

I’m not entirely sure what all this does at the moment (I will learn) but the general gist is that it makes sure the compiler knows where all the libraries are, compiles and links the code.

The main.cpp File

Finally enter the following into a new Main.cpp file:




int main() {

GLFWwindow* window = glfwCreateWindow(800, 600, "Vulkan window", nullptr, nullptr);

uint32_t extensionCount = 0;
vkEnumerateInstanceExtensionProperties(nullptr, &extensionCount, nullptr);

std::cout << extensionCount << " extensions supported\n"; glm::mat4 matrix; glm::vec4 vec; auto test = matrix * vec; while(!glfwWindowShouldClose(window)) { glfwPollEvents(); } glfwDestroyWindow(window); glfwTerminate(); return 0; }

Compile and run the code and I have a window 😀


This took a lot of time to get right - it comes from a mix of following the Vulkan Tutorial's setup instructions (which are a good guide but don't fully work on Apple Silicon) and analysing the source code from Brendan Gales YouTube Channel (again changes were needed to make it work on Apple Silicon).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.