Installation and setup Mac OS

Hi,

If you have problems installing raylib on a Mac I suggest using Homebrew.

Homebrew does not install the source code so you will need to clone/download raylib-master from github.

Copy the src directory to /usr/local/Cellar/raylib/3.7.0, note this is the version or raylib I installed.

Edit the c_cpp_properties.json file and the tasks.json file in the .vscode folder.
Where you see <path_to_raylib> change to /usr/local/opt/raylib. Note Homebrew puts the symlink to ray lib in /usr/local/opt.

In the c_cpp_properties.json file I had to change “macFrameworkPath”: [
“/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk/System/Library/Frameworks” , 11.3 as this is my current Mac OS.

When you select build task in vs code use build debug (viscode-template)

I hope this information useful to someone.

Cheers,
James

1 Like

Hey, I am having an issue with the ray lib.h header file not being found even though I have both files in the .vscode folder setup correctly. Im running MacOS Monterey beta and Xcode 13 beta, but other than changing a few things with the Mac framework path it shouldn’t change anything? did you encounter an error with VS Code not finding the header file?

Nevermind, VS Code suggesting adding the file path in the C++ configurations

Of course I’m pretty lost here.

I’ve done all the steps and can’t seem to know how to debug in VSCode on a Mac.

I’m getting this error:

Running] cd “/Users/LGuzman/Desktop/Cpp/Axe Game/” && g++ axe_game.cpp -o axe_game && "/Users/LGuzman/Desktop/Cpp/Axe Game/"axe_game
Undefined symbols for architecture x86_64:
“_InitWindow”, referenced from:
_main in axe_game-4c9c79.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

[Done] exited with code=1 in 0.082 seconds

Is there any way to install raylib without using xcode or third party systems ?
I downloaded the tar.gz file for mac OS and extracted it to a folder but now what ?

By the way I have VScode installed on my mac and there is no instruction for the compiler part that point to an exe file. Is it possible to add a lecture that help mac and linux users to configure the tools for their OS so we can follow all along for the next lecture.

Thanks in advance for helping me out !

1 Like

@Chinzu I believe XCode is part of Mac OS. The problem seems to be that you need to build raylib on your system (a kind of typical Linux deal).

Unfortunately, the VSCode Template that is also to be installed for the course seems very wedded to VS Code on Windows. That might be only superficial although I don’t have the skills to know differently at this point, and definitely not to do anything about it.

The problem is that it takes a lot more beyond beginner skills to wrestle with these cases, and then come up with something that beginners can carry out safely.

PS: Normally, it might be possible to simply use VS Code and setup g++ to do compiles in Terminal operation on Mac OS. That won’t help when raylib is needed.though.

Hi Chinzu,

If you download the raylib-master source from github you can use the cmake example in the projects folder.

Read the READ.md files for instructions.

Cheers,
James

Hey all, we have now updated the VSCode Template so that no extra steps should be necessary to install. Just install raylib through Homebrew. If you don’t know how, there’s now a dedicated Mac install lectured by me.

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms