Compiling in Mac OS X
Compiling for Mac OS X is not hard; someone else has already gone through the pain of compiling all dependencies and utilities. Compiling requires an Intel Mac.
- Download the Source
- Download a build of FB pre-1.06 . This is a branch of the official version not yet merged in. The sources for this WIP Mac port of FB are here. (The obsolete sources for that old 20160505 build are here). This branch is not yet merged upstream, but hopefully will be soon.
- Either make sure that the fbc executable is in your PATH, or pass the fbc argument to scons (or set FBC environment variable) to point to it.
- Install the SDL 1.2 and SDL_mixer 1.2 and/or SDL 2.0 and SDL_mixer 2.0 frameworks, depending on whether you want to compile gfx_sdl/music_sdl (soon to be obsolete) or gfx_sdl2/music_sdl2 (future default) backends.
- scons looks for the frameworks both in /Library/Frameworks and ~/Library/Frameworks, or calls sdl-config.
- There may be other ways to install scons, but what worked for me was to install MacPorts and then run sudo port install scons, or install Homebrew and run brew install scons.
- In the main 'wip' directory, run 'scons' as usual, or 'scons .', etc. All targets should work (hspeak requires Euphoria)
- Run ./bundle-apps.sh to produce OHRRPGCE-Custom.app and OHRRPGCE-Game.app. This is optional; you can just run ohrrpgce-custom and ohrrpgce-game directly
- You can run ./distrib-mac.sh to package a distribution.
You need clang or an Apple gcc compiler to compile objective-C code (mac/SDLMain.m) because the system headers use blocks, which aren't supported by FSF GCC without Apple's patch for blocks added. For example GCC from macports doesn't work. clang does support blocks. XCode 4.2/GCC 4.2.1 is tested and confirmed working.
Versions Gorgonzola and earlier required gcc to compile FB code translated to C (clang masquerading as gcc did not work), but the releases starting with hróðvitnir and later can be compiled with clang. gcc is still used instead of clang if it is in the PATH. Run scons compiler=clang to prefer clang.
(Note for old versions: It is actually possible to use one compiler ('GCC') for FB code translated to C, and a different compiler ('CC') for the C/C++/Objective-C code (any version of Apple gcc or clang or gcc-clang) like so:
CC=clang GCC=/opt/local/bin/gcc scons
XCode 4.2/Apple GCC 4.2.1, and GCC 4.9.3 from MacPorts are both known to work.)
Things you don't need to compile
mac/utilities.tar.gz and mac/utilities-x86_64.tar.gz also includes x86 and x86_64 builds (not fat binaries) of madplay and oggenc.
wip/mac/Frameworks.tar.gz contains x86-only builds of SDL and SDL_mixer; SDL.Framework is also missing headers to reduce its size. SDL_mixer has had a patch applied (see below) to fix Midi looping, though more recent SDL_mixer released have this fixed. Good luck trying to configure the Xcode projects to compile for Intel only.
FB 0.22 Mac port
This information about the original port of FB 0.22 to OSX is preserved here for the moment.
Build of unofficial Mac port of FreeBASIC 0.22: 
Lately only compiling on OS 10.7 with XCode 4.2/GCC 4.2 has been tested, though all other versions of Mac OS should work too (only with a recent GCC?). OS 10.6 and 10.5 have previously been used; 10.4 has never been tested. 10.3 and older are PPC-only.
Compiling with support for older versions of Mac OS
(This section is out of date or incorrect)
By default compiling C code on OS 10.6+ will produce binaries that won't run on OS 10.4 and 10.5. To rectify this, you need a compatible build of FB, a compatible build of Euphoria, and have the OS 10.4 (recommended) or 10.5 SDK installed. Sadly you can't install these SDKs via more recent XCode versions; officially they are no longer supported, though they still seem to work.
- FB for OS 10.4+: fixme
- Euphoria 4.0.5 for OS 10.4+: 
- (Note: the euc in this Euphoria build assumes that the OS 10.4 SDK is installed at /Developer/SDKs/MacOSX10.4u.sdk. If you want to compile on an actual 10.4/5 system without the SDK, get euc to generate a makefile and remove the -isysroot flag in it.
Compile with scons macsdk=10.4 or other Mac OSX SDK.
Actually you can use this FB build on all Intel Macs, but it produces annoying warning messages if not used in combination with with macsdk argument, and might not link correctly?
It might be nice to package games for Mac as .pkg Installers instead of .tar.gz files. These can be created on other OSes using a few simple programs (cpio, xar, gzip, bomutils):