Skip to content

Simple MacOS support#221

Open
enzofrnt wants to merge 10 commits intoBeamMP:masterfrom
enzofrnt:macos-support
Open

Simple MacOS support#221
enzofrnt wants to merge 10 commits intoBeamMP:masterfrom
enzofrnt:macos-support

Conversation

@enzofrnt
Copy link

@enzofrnt enzofrnt commented Jan 9, 2026

This PR introduces initial macOS support.

This implementation is not finished yet and may require further improvements.

Adding macOS support does not require major changes to the launcher because of the existing Linux support. The main difficulty is handling the game path.

On macOS, BeamNG.drive is usually run through CrossOver, which adds multiple layers (Wine, bottles, custom directories). Because of this complexity, the game installation path cannot be reliably detected automatically.

The launcher still requires this path to function correctly, so it must currently be provided manually by the user.

A possible improvement would be to store the last known game path (for example in the Resources directory) to avoid asking for it again on future launches.

Maintenance

A new CI is setup to build the MacOS version of the launcher for us. If it fails, mention me and I’ll come to help fix the issue. Considering the limited number of macOS users for BeamMP, it can be fixed later if not done in time.

Documentation

If necessary, I can create some documentation on how to run BeamMP on macOS. Anyone needing help can then contact me.


By creating this pull request, I understand that code that is AI generated or otherwise automatically generated may be rejected without further discussion.
I declare that I fully understand all code I pushed into this PR, and wrote all this code myself and own the rights to this code.

Updated the CMakeLists.txt to treat APPLE as a supported platform alongside UNIX for dependency linking. This ensures proper library linking on macOS systems.
Introduces a workflow to build the project on macOS using CMake and vcpkg. The workflow installs dependencies, configures and builds the project for arm64 architecture, and uploads the resulting artifact.
Added .DS_Store, vcpkg_installed, and platform-specific build directories to .gitignore to prevent accidental commits of system and build artifacts.
Extended platform checks to include __APPLE__ for macOS support in multiple files. Added macOS-specific logic for game path detection, legitimacy check, and error handling where game launching is not supported. Updated includes and platform-specific code paths to ensure compatibility with both Linux and macOS.
Removed platform-specific preprocessor checks for the 'clear' system command in ReLaunch(). Now, 'system("clear")' is called unconditionally for all platforms.
Adds steps to configure the SDKROOT and MACOSX_DEPLOYMENT_TARGET environment variables in the cmake-macos GitHub Actions workflow to ensure consistent build environment targeting macOS 11.0.
@enzofrnt enzofrnt mentioned this pull request Jan 9, 2026
@enzofrnt enzofrnt changed the title Add simple MacOS support Simple MacOS support Jan 9, 2026
}
#elif defined(__APPLE__)
std::filesystem::path GetGamePath() {
// Right now only steam is supported
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you elaborate on this comment?

struct passwd* pw = getpwuid(getuid());
std::string homeDir = pw->pw_dir;

std::string Path = homeDir + "/Library/Application Support/BeamNG/BeamNG.drive/";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will the user data folder always be in this location?

Comment on lines +218 to +228
// macOS does not support game launching - StartGame is never called
void StartGame(std::string Dir) {
// This function should never be called on macOS
error("Game launching is not supported on macOS");
}
#endif

void InitGame(const beammp_fs_string& Dir) {
#if defined(__APPLE__)
// macOS does not support game launching
return;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is not support and should never be called why define the function or call it in the first place?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, i'm fixing it.

Comment on lines +284 to +289
info("Please enter the path to your BeamNG.drive installation directory:");
info("Example: /Users/YourName/Library/Application Support/Steam/steamapps/common/BeamNG.drive");
std::cout << "Game directory path: ";

std::string userPath;
std::getline(std::cin, userPath);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could command line arguments be used instead of this interface?

Comment on lines +291 to +294
// Remove trailing slash if present
if (!userPath.empty() && (userPath.back() == '/' || userPath.back() == '\\')) {
userPath.pop_back();
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could std::filesystem::path be used for this instead?

return;
}

GameDir = gamePath.string() + "/";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could std::filesystem::path be used here as well?

#elif defined(__linux__)
// Linux version of the game cant handle mods with uppercase names
#elif defined(__linux__) || defined(__APPLE__)
// Linux and macOS versions of the game cant handle mods with uppercase names
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the mac version the windows version of the game running with a translations layer, making it able to handle uppercase names?

Refactors InitGame to exclude its definition on macOS and updates main.cpp to only call InitGame when not on macOS. This prevents attempts to launch the game on macOS, where it is not supported.
Deleted the macOS-specific StartGame function, as game launching is not supported and the function is never called on that platform.
Replaces incorrect use of 'defined' with preprocessor directive '#if !defined(__APPLE__)' to ensure InitGame is only called on non-Apple platforms.
@Starystars67
Copy link
Member

@enzofrnt please can you response to the comments above?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants