Skip to Content

Compiling on macOS

Dependencies

BZFlag uses Xcode and a several third-party dependencies to build on macOS.

  • Xcode
  • SDL 2.0.9+
  • GLEW
  • c-ares

Homebrew

As an alternative to manual installation of the various dependencies, the homebrew package manager can simplify installing external packages, if you have it installed.

brew install sdl2 glew c-ares

SDL

Download the latest development library .dmg file and open it. Drag the SDL2.framework file into your /Library/Frameworks/ directory, which may require an administrator account to accomplish.

GLEW

Download the latest GLEW .tgz source release and extract the contents. Open a Terminal and cd into the glew directory that was just created by extracting. Then run the following commands:

export MACOSX_DEPLOYMENT_TARGET=10.7
export GLEW_DEST=/usr/local
make glew.lib
sudo make install
sudo rm /usr/local/lib/libGLEW*.dylib

c-ares

Download the latest c-ares source release and extract the contents. Open a terminal and cd into the c-ares directory that was just created by extracting. Then run the following commands:

export MACOSX_DEPLOYMENT_TARGET=10.7
./configure --disable-shared
make
sudo make install

Obtaining the code

For BZFlag 2.4:

Either download and extract the specific release source .tar.gz or .tar.bz2 from our downloads archive or use Git to download the current 2.4 branch.

git clone --branch 2.4 https://github.com/BZFlag-Dev/bzflag.git

For BZFlag master (2.5):

git clone --branch master https://github.com/BZFlag-Dev/bzflag.git

Building the code

Nagivate to the Xcode directory of our source and open BZFlag.xcodeproj. This will launch Xcode.

By default we build in debug mode which leaves debugging symbols in the binaries and produces less optimized code. To change this, navigate to the Product menu, then to Scheme, and click on Edit Scheme. Then in the left sidebar click on the Run phase, and then the Info tab. Under Build Configuration, select the desired scheme of Debug or Release.

To build, select Build from the Product menu. If the build was successful, you can run the application from Xcode by selecting the Product menu and clicking on Run.

To locate the .app you just created, access the Navigator panel and select the Project Navigator. Expand the "BZFlag" project container and the "Targets" group within it. Click the "BZFlag.app" target. Make sure the Utilities page is visible, and under the Identify and Type panel it will show the full path to the application. Click the small grey right arrow at the bottom right corner of the path to reveal the application in the Finder.

More information

For more information, review the README.MacOSX and DEVINFO files from the source.

This content is maintained on GitHub. We welcome any feedback and improvements!

Give us Feedback Edit this Page