Difference between revisions of "Installing Lazarus on macOS"
Jwdietrich (talk | contribs) (Screenshots added.) |
|||
Line 11: | Line 11: | ||
=== Xcode 5.0+ compatibility (Mac OS X 10.9) === | === Xcode 5.0+ compatibility (Mac OS X 10.9) === | ||
− | Xcode 5 no longer installs the command line tools by default. These are required by FPC/Lazarus. Unlike in Xcode 4, the installation option is no longer accessible in Xcode 5. Addtionally, the "Locations" tab of the preferences dialog | + | Like Xcode 4.3+, Xcode 5 no longer globally installs the command line tools by default. These are required by FPC/Lazarus. Unlike in Xcode 4 however, the installation option is no longer accessible in Xcode 5 via the Downloads tab. Addtionally, the "Locations" tab of the preferences dialog may be confusing, as it mentions that the command line tools are installed: |
<gallery> | <gallery> | ||
− | Image:xcode5 misleading screenshot.png| | + | Image:xcode5 misleading screenshot.png|Default location of command line tools in Xcode 5. |
Image:xcode select.png|Installation of command line tools with the xcode-select command part 1... | Image:xcode select.png|Installation of command line tools with the xcode-select command part 1... | ||
Image:command line tools installation on mavericks.png|...and part 2. | Image:command line tools installation on mavericks.png|...and part 2. | ||
</gallery> | </gallery> | ||
− | + | The first dialog box shows that by default the command line tools are only installed inside the Xcode.app bundle itself. To install them globally, as required by FPC/Lazarus, execute the following terminal command: | |
xcode-select --install | xcode-select --install |
Revision as of 11:40, 7 October 2013
Template:Installing Lazarus on MacOS X
Installation
This document describes FPC+Lazarus installation on Apple Mac OS X desktops/laptops.
For authorative/more detailed instructions for FPC, please go to [1]
Prerequisites: Apple Developer Tools
You need the Apple Developer tools, which are a part of the XCode development environment. They can be installed from the original Mac OS X installation disks or downloaded from the Apple Developer Connection (ADC), which requires free registration: http://developer.apple.com/.
Xcode 5.0+ compatibility (Mac OS X 10.9)
Like Xcode 4.3+, Xcode 5 no longer globally installs the command line tools by default. These are required by FPC/Lazarus. Unlike in Xcode 4 however, the installation option is no longer accessible in Xcode 5 via the Downloads tab. Addtionally, the "Locations" tab of the preferences dialog may be confusing, as it mentions that the command line tools are installed:
The first dialog box shows that by default the command line tools are only installed inside the Xcode.app bundle itself. To install them globally, as required by FPC/Lazarus, execute the following terminal command:
xcode-select --install
Xcode 4.3+ compatibility (Mac OS X 10.7/10.8)
Xcode 4.3 and later no longer install the command line tools by default. These are required by FPC/Lazarus.
To install them manually, open Xcode, go to Preferences, select "Downloads;" and install the "Command Line Tools". Afterwards, FPC will install and function correctly.
It will be necessary to reinstall the command line tools after each upgrade of Xcode (especially when it's a new major version, the installer may delete the old copies of the command line tools), and also after switching to a new major version of the system software (idem).
Xcode 3.2.x compatibility (Mac OS X 10.6)
FPC 2.6.0: there is an issue when compiling dynamic libraries with FPC under Mac OS X 10.6 due to a bug in the Xcode 3.2.x linker. This bug has been fixed in Xcode 4. You can work around the bug in Xcode 3.2.x by using the -k-no_order_inits command line parameter when compiling a dynamic library.
Xcode 3.1.x compatibility (Mac OS X 10.5)
Most versions of Lazarus and FPC are compatible with Xcode 3.1 (see the compatibility matrix for detailed reference). The Xcode integration kit is provided as an optional install to allow for developing with Free Pascal directly from Xcode. It is not required for development with Lazarus, however.
Xcode 2.0 compatibility (Mac OS X 10.4)
Most versions of Lazarus and FPC are compatible with Xcode 2.0 (see the compatibility matrix for detailled reference). The Xcode integration kit is provided as an optional install to allow for developing with Free Pascal directly from Xcode. It is not required for development with Lazarus, however.
Install Packages / Released version
Compatibility
Not every combination of Lazarus and Free Pascal is compatible with every installation of Mac OS X. Please refer to the following table in order to find the correct version for your development environment:
Lazarus 1.8.x | Lazarus 2.0.y | Lazarus 2.0.8 | Lazarus 2.0.10 | Lazarus 2.0.12 | Lazarus 2.2.y | ||
---|---|---|---|---|---|---|---|
FPC 3.0.4 | FPC 3.2.0 | FPC 3.2.2 | |||||
PPC processors | |||||||
Mac OS X 10.4 (Tiger)‡ | Incompatible | Incompatible | Incompatible | Incompatible | Incompatible | Incompatible | Incompatible |
Mac OS X 10.5 (Leopard)‡ | Not tested | Not tested | Incompatible | Incompatible | Incompatible | Incompatible | Incompatible |
Intel processors | |||||||
Mac OS X 10.4 (Tiger)‡ | Incompatible | Incompatible | Incompatible | Incompatible | Incompatible | Incompatible | Incompatible |
Mac OS X 10.5 (Leopard) | Not tested | Compatible^ | Not tested | Compatible^**† | Not tested | Not tested | Not tested |
Mac OS X 10.6 (Snow Leopard) | Compatible | Compatible^^ | Not tested | Not tested | Not tested | Not tested | Not tested |
Mac OS X 10.7 (Lion) | Compatible | Not tested | Not tested | Not tested | Not tested | Not tested | Not tested |
OS X 10.8 (Mountain Lion) | Compatible^^ | Compatible | Compatible**# | Compatible**# | Compatible**# | Compatible# | Compatible |
OS X 10.9 (Mavericks) | Compatible^^ | Compatible | Compatible**† | Compatible**† | Not tested | Not tested | Not tested |
OS X 10.10 (Yosemite) | Compatible^^ | Compatible | Compatible**† | Compatible**† | Not tested | Not tested | Not tested |
OS X 10.11 (El Capitan) | Compatible^^ | Compatible | Compatible***† | Compatible† | Compatible† | Compatible† | Comptaible |
macOS 10.12 (Sierra) | Compatible^^ | Compatible | Compatible***† | Compatible† | Compatible† | Compatible† | Compatible |
macOS 10.13 (High Sierra) | Not tested | Compatible | Compatible***† | Compatible† | Compatible† | Compatible† | Comptaible |
macOS 10.14 (Mojave) | Not tested | Compatible | Compatible***† | Compatible† | Compatible† | Compatible† | Compatible |
macOS 10.15 (Catalina) | Not tested | Compatible | Compatible***† | Compatible† | Compatible† | Compatible† | Compatible |
macOS 11 (Big Sur) | Not tested | Compatible | Compatible***† | Compatible† | Compatible† | Compatible† | Compatible |
macOS 12 (Monterey) | Not tested | Not tested | Not tested | Not tested | Not tested | Not tested | Compatible |
macOS 13 (Ventura) | Not tested | Not tested | Not tested | Not tested | Not tested | Not tested | Compatible |
macOS 14 (Sonoma) | Not tested | Not tested | Not tested | Not tested | Not tested | Not tested | Compatible |
Apple Silicon M series processors | |||||||
macOS 11 (Big Sur) | Not tested | Not tested | Not tested | Compatible†† | Compatible†† | Compatible††† | Compatible* |
macOS 12 (Monterey) | Not tested | Not tested | Not tested | Compatible†† | Compatible†† | Compatible††† | Compatible* |
macOS 13 (Ventura) | Not tested | Not tested | Not tested | Compatible†† | Compatible†† | Compatible††† | Compatible* |
macOS 14 (Sonoma) | Not tested | Not tested | Not tested | Compatible†† | Compatible†† | Compatible††† | Compatible* |
x = 0, 2 or 4; y = 0, 2, 4 or 6
^ Carbon interface compiles - Cocoa does not.
^^ Restrictions apply to debugging with gdb.
* Lazarus 2.2.0 installs universal binaries for FPC 3.2.2, but an Intel Lazarus IDE binary which you can use or recompile the IDE from within itself for a native aarch64 version.
** See Installing Lazarus 2.0.8, 2.0.10 with FPC 3.2.0 for macOS 10.10 and earlier for instructions.
*** See Installing Lazarus 2.0.8 with FPC 3.2.0 for macOS 10.11+ for instructions.
# Cannot run without debugging in the IDE. Can run compiled application outside of the IDE. See Issue #37324. Choose the gdb debugger, change timeout option to false or click through five "timeout" dialogs to run with debugging in the IDE.
† Cannot "run without debugging" in the IDE. Can run compiled application outside of the IDE. See Lazarus IDE - Unable to "run without debugging" for workaround. See Issue #36780.
†† You need to compile a native aarch64 version of FPC 3.3.1 (trunk) and Lazarus 2.0.12 from source to support an Apple Silicon M series processor. Refer to these instructions for FPC and these instructions for the Lazarus IDE.
††† After installing FPC 3.2.2, you need to compile a native aarch64 version of Lazarus from source to support an Apple Silicon M series processor. Refer to these instructions for compiling the Lazarus IDE.
‡ See the legacy version of this compatibility matrix for recommended installs on very old versions of macOS.
Installation from disk images
Download the three disk images (.dmg files) for fpc, fpcsrc and lazarus from either of the following links:
Open up each disk image and install in this order:
- fpc
- fpcsrc
- Lazarus
After installation the Lazarus application can be found in /Developer/lazarus/, the FPC source files in /usr/local/share/fpcsrc.
If you receive a "Can't find unit Interfaces used by Project1" error on trying to compile a blank form, check the following settings in Lazarus (should be set by default):
Environment Options
Lazarus directory: /Developer/lazarus Compiler path: /usr/local/bin/ppc386 (PowerPC Macs: /usr/local/bin/ppcppc) FPC Source: /usr/local/share/fpcsrc
Project | Options
All paths blank LCL Widget Type: default (Carbon beta)
Project | Inspector
Required Packages LCL
Note - different versions of Lazarus depend on particular versions of the FreePascal compiler and will not work with other versions.
Another common problem is that the versions of fpc and fpcsrc are different.
This is the easiest way to install Lazarus on Mac OS X.
Installation using fink
To obtain the up-to-date release versions of lazarus (1.0.10) AND freepascal (2.6.2) 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. It really takes some time to build all packages, in particular on older Macs.
After installation, Lazarus can be started from the folder /Applications/Fink/. The actual details of fpc and lazarus 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.
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.6.x is stable version without new features - only bug fixes. The unstable version 2.7.x comes with lots of new features but sometimes also with bugs. Best is to download and install fpc 2.6.x. 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: IF the current SVN of FreePascal can not be compiled using the stable release of FreePascal that comes with the current stable version of Lazarus (FPC 2.6.*), you will need a newer compiler. In order to compile the latest versions of FPC, first install a precompiled 2.6.* series compiler. You can get a compiled version of FPC 2.6.* at http://www.freepascal.org/download.var. Note: only do this if the instructions below do not work.
The sources are kept in a version control system called subversion or short svn:
- 10.5 and higher already contains svn clients. 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:
open lazarus.app
Uninstalling Lazarus and Free Pascal
Normally you uninstall an application on OS X simply by dragging it from the Applications folder to the trash. But because Lazarus and Free Pascal are development tools, they're installed in several folders that you don't normally see in Finder.
You can copy and save the commands below to file uninstallLaz.sh and run it if you need to uninstall Lazarus and Free Pascal. You can usually install newer versions of Lazarus and Free Pascal over older versions, but as with most software it's not a bad idea to clean out everything before you install a newer version. This list of commands should also give you a sense of where the various pieces of Lazarus and Free Pascal are located.
bin=/usr/local/bin
share=/usr/local/share
lib=/usr/local/lib
receipts=/Library/Receipts
private=/private/etc
rm -fv $bin/ppcppc
rm -fv $bin/ppc386
rm -fv $bin/bin2obj
rm -fv $bin/data2inc
rm -fv $bin/delp
rm -fv $bin/fd2pascal
rm -fv $bin/fpc
rm -fv $bin/fpcmake
rm -fv $bin/fpcmkcfg
rm -fv $bin/fpcsubst
rm -fv $bin/fpdoc
rm -fv $bin/fprcp
rm -fv $bin/h2pas
rm -fv $bin/h2paspp
rm -fv $bin/makeskel
rm -fv $bin/mkxmlrpc
rm -fv $bin/plex
rm -fv $bin/postw32
rm -fv $bin/ppdep
rm -fv $bin/ppudump
rm -fv $bin/ppufiles
rm -fv $bin/ppumove
rm -fv $bin/ptop
rm -fv $bin/pyacc
rm -fv $bin/rstconv
rm -fv $bin/unitdiff
rm -r $private/lazarus
rm -r $bin/lazarus
rm -r $share/lazarus
rm -r $share/fpcsrc
rm -r $share/doc/fpc-2.2.2
rm -r $share/examples/fpc-2.2.2
rm -r $lib/fpc
rm -r $receipts/lazarus-*.pkg
rm -r $receipts/fpcsrc-*.pkg
rm -r $receipts/fpc-*.pkg
rm -fv /etc/fpc.cfg
Note that this assumes you have version 2.2.2 snapshot of Free Pascal installed. If you have a different version, change the two relevant commands to specify your version.
To run this script, change to the directory where it's stored and enter:
chmod +x uninstallLaz.sh
sudo ./uninstallLaz.sh
Then enter your password when prompted.
Note: Lazarus also creates a .lazarus folder in your home directory where it stores environment settings and a list of recently opened projects and files. You can leave this folder alone if you want the new version of Lazarus you're installing to use your old settings. OS X normally doesn't show files or folders whose names start with a dot (.). To see this folder and its contents, enter the following in a terminal window:
cd ~/
ls -al
cd .lazarus
ls
To remove it, execute the following commands:
cd ~/
rm -rv .lazarus
Known issues
- FPC 2.4.4 has a bug. You can not compile the IDE with the range check flag -Cr.
- On OS X 10.4 you have to manually uninstall any previous version before installing a new dmg. Delete the following files and folders:
- /Developer/lazarus
- /Library/Receipts/lazarus.pkg
- /etc/lazarus
- /usr/local/bin/lazbuild
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.
- Sometimes the blinking cursor vanishes after closing a file. Just switch to another page and back.
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