Installing Lazarus on macOS
Template:Installing Lazarus on MacOS X
Installation
Apple Developer Tools
You need the Apple Developer tools. They can be installed from the original OS X installation disks or downloaded from the Apple Developer Connection (ADC), which requires free registration: http://developer.apple.com/.
Install Packages / Released version
Installation from disk images
First download and install the FPC package from http://sourceforge.net/projects/freepascal/files/Mac%20OS%20X/2.2.4/
Then, download and install FPCSrc and Lazarus in this order from https://sourceforge.net/project/showfiles.php?group_id=89339
This is the easiest way to install Lazarus on Mac OS X. The FPC sources are installed under /usr/local/share/fpcsrc.
Installation using fink
To obtain the up-to-date release versions of lazarus (0.9.28.2) AND freepascal (2.4.0) use fink, a package manager for Mac OS X. The extra bonus of fink is easy installation as well as clean removal of a huge number of other open source software packages, including FreePascal crosscompilers for other processors and systems. The choice for lazarus is between an Aqua (preferred by most) and a gtk2 look of lazarus:
$ fink install lazarus-aqua
or
$ fink install lazarus-gtk2
This also installs a number of other packages, such as the FreePascal compiler, the lazarus sources, gtk2 libraries and more. At the prompt, whether you want to install these additional packages, simply hit RETURN and go for a coffee.
After installation, Lazarus can be started from the folder /Applications/Fink/. The actual details are in subdirectories of /sw
With both (Aqua AND gtk2) looks, these widget sets for your program are supported on Intel- and PowerPC-Macs:
carbon (Aqua), gtk2, nogui
On Intel-Macs these additional cross platform widget sets are supported:
carbon (Aqua) for powerpc, win32 and wince.
Projects with the gtk1 widget set are also supported on 10.4 and 10.5 through the lazarus-common-gtk1 package. On 10.6, gtk1 libraries are deprecated in general and you have to port your project to the gtk2 or carbon widget set.
Installation using SVN
To get the current development version see below.
Install from Source / Development version
You need the latest stable released FPC installed in order to compile the development version.
Download and install a compiler
Download and install the FPC package: https://sourceforge.net/project/showfiles.php?group_id=89339
There are two development versions of the compiler: 2.2.x is stable version without new features - only bug fixes. And the unstable 2.5.x with lots of new features and bugs. The 2.2.0 version has a bug and can not be used to compile the 2.2.4 nor 2.5.1. Best is to download and install fpc 2.2.4. Some daily snapshots can be found here. Keep in mind that these are daily snapshots and that you can have bad luck and get a buggy version. The probability is about 1:30. So if the version is buggy try another day or use the released packages instead.
Download the sources via svn
- Note: the current SVN of freepascal (2.5.1) can not be compiled using the stable release of freepascal (2.2.4) that comes with the current stable version of Lazarus. Therefore, in order to compile the latest versions of fpc, you will want to first install a precompiled 2.4 series compiler. You can get a compiled version of fpc 2.4 at http://www.freepascal.org/download.var
The sources are kept in a version control system called subversion or short svn:
- 10.5 already installs svn. Users of earlier versions must install SVN for Mac OS X: A good package is provided by Martin Ott. You can also use fink. SVN clients with GUI (graphical user interface) are available from Versiontracker. A quite handy client, which integrates in Finder, is SCPlugin.
Create a directory, where you would like to put the sources. You don't need to be root to do this. Any normal user can do this. First create a directory for fpc
- (e.g. /Users/username/freepascal)
then open a terminal and do the following:
[]$ svn co http://svn.freepascal.org/svn/fpc/trunk fpc
This will create a directory called 'fpc', which can be later used in the IDE. Hint: To download/update the latest changes you can simply do
[]$ cd /Users/username/freepascal/fpc []$ svn up
Building fpc
[]$ make clean all []$ sudo make install
Then download lazarus
[]$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus
This will create a directory called 'lazarus'. To update the latest changes:
[]$ cd /Users/username/freepascal/lazarus []$ svn up
Building lazarus
[]$ make clean all
Then start lazarus either via command line or by double click in the finder:
./lazarus.app/Contents/MacOS/lazarus
First Steps
The carbon interface has matured and is probably preferred over the gtk2 interface by most users of lazarus:
- The carbon IDE looks somewhat nicer, although autosizing does not yet work correctly. Therefore, some dialogs look pretty bad until you enlarge them manually.
- There is no optimal set of IDE shortcuts for the Mac yet. Therefore, many features like help, identifier completion, toggle form/unit, compile, run, jump back do not work, because OS X itself uses these shortcuts. You must change the shortcuts in the editor options / keymappings. Beware, some key combos are not yet recognized and can give errors. At the moment it is recommended to only use Cmd-letter and Cmd-Shift-letter combinations.
- Sometimes, the Alt key ceases to function. Just restart the IDE. It starts quite fast.
- The blinking cursor vanishes after the popup of menus and modal forms. Just switch to another page and back. Again, the normal page switching short cuts do not work. You may want to define some of them in the keymappings.
See Also
Other Interfaces
- Lazarus known issues (things that will never be fixed) - A list of interface compatibility issues
- Win32/64 Interface - The Windows API (formerly Win32 API) interface for Windows 95/98/Me/2000/XP/Vista/10, but not CE
- Windows CE Interface - For Pocket PC and Smartphones
- Carbon Interface - The Carbon 32 bit interface for macOS (deprecated; removed from macOS 10.15)
- Cocoa Interface - The Cocoa 64 bit interface for macOS
- Qt Interface - The Qt4 interface for Unixes, macOS, Windows, and Linux-based PDAs
- Qt5 Interface - The Qt5 interface for Unixes, macOS, Windows, and Linux-based PDAs
- GTK1 Interface - The gtk1 interface for Unixes, macOS (X11), Windows
- GTK2 Interface - The gtk2 interface for Unixes, macOS (X11), Windows
- GTK3 Interface - The gtk3 interface for Unixes, macOS (X11), Windows
- fpGUI Interface - Based on the fpGUI library, which is a cross-platform toolkit completely written in Object Pascal
- Custom Drawn Interface - A cross-platform LCL backend written completely in Object Pascal inside Lazarus. The Lazarus interface to Android.
Platform specific Tips
- OS X Programming Tips - Lazarus installation, useful tools, Unix commands, and more...
- WinCE Programming Tips - Using the telephone API, sending SMSes, and more...
- Windows Programming Tips - Desktop Windows programming tips.
Mac How To Articles
Mac How - If you having troubles in solving some major issues.
Interfaces Development Articles
- Carbon interface internals - If you want to help improving the Carbon interface
- Windows CE Development Notes - For Pocket PC and Smartphones
- Adding a new interface - How to add a new widget set interface
- LCL Defines - Choosing the right options to recompile LCL
- LCL Internals - Some info about the inner workings of the LCL