https://wiki.freepascal.org/api.php?action=feedcontributions&user=McSquirrel&feedformat=atomFree Pascal wiki - User contributions [en]2024-03-29T08:25:56ZUser contributionsMediaWiki 1.35.6https://wiki.freepascal.org/index.php?title=Cocoa_Interface&diff=123259Cocoa Interface2019-02-15T19:12:15Z<p>McSquirrel: /* Compiling */ added instructions for compiling Cocoa 64bit apps</p>
<hr />
<div>{{Platform only|macOS|macOS|macOS}}<br />
{{Platform only|iOS|iOS|iOS}}<br />
{{Other Interfaces}}<br />
==Cocoa bindings==<br />
This interface uses the native support in Free Pascal for direct communication with Objective-C was added through the [[FPC PasCocoa|Objective Pascal]] dialect.<br />
<br />
==Compiling==<br />
===Prepare your Lazarus project for using Cocoa===<br />
You may need to set the Target to the 64bit processor and select the Cocoa Widget set:<br />
<br />
*Open your project with Lazarus and click Project/ProjectOptions<br />
*In the "Config and Target" panel set the "Target CPU family" to be "x86_64"<br />
*In the "Additions and Overrides" panel click on "Set LCLWidgetType" pulldown and set the value to "Cocoa"<br />
*In the past, for some reason Lazarus kept setting the compiler to "/usr/local/bin/ppc386" - which results in 32 bit apps. Make sure under Tools->Options that "Compiler Executable" is set to "/usr/local/bin/fpc" to get 64 bit apps.<br />
*Now compile your project - with any luck it will work OK.<br />
<br />
===Error ATSUFindFontFromName===<br />
if you're getting an error<br />
carbonproc.pp(563,13) Error: Identifier not found "ATSUFindFontFromName"<br />
when compiling a project for macOS using FPC 3.0.4 you need:<br />
* either set CPU target explicitly to i386. (FPC 3.0.4 compiles to x86_64 for darwin target by default. This is done due Apple stopping support for 32-bit target)<br />
:*You either set the target in Project options (by switching it from default to i386)<br />
:*or if you compiling from command-line (i.e building an IDE) set up the following parameter to make command<br />
CPU_TARGET=i386<br />
* either set LCL target (widgetset) to "Cocoa"<br />
<br />
==Cocoa FAQ==<br />
<br />
===TButton looks too small!===<br />
If you design a button in another widgetset with Autosize=Off it might happen that the button looks too small in Cocoa, and a number of people complained about this, such as in these BTS reports: [https://bugs.freepascal.org/view.php?id=31185]. <br />
<br />
If you don't care about the button size, just set AutoSize=True. If you want to have a custom width for the button, but wants to allow the LCL to choose the right Height so that the button will look good in Cocoa, then the solution in this case is to set the following properties in the Object Inspector:<br />
<br />
* AutoSize=True<br />
* Constrains.MinWidth = Constrains.MaxWidth = your desired width.<br />
<br />
===Overlapping Widgets===<br />
Lazarus allows you to set the depth of different widgets, such that when two widgets overlap, the "closer" object blocks the view of the more "distant" object. You can do this at design time (right-click on object and click "Z-order") or at run time with functions like "BringToFront" and "SendToBack". Be aware that this may not always work with Cocoa. This is a 'feature' of Cocoa, as clipping is optimized for performance. Therefore, if you plan to compile your projects for Cocoa it is a good strategy to avoid overlapping widgets or to place them on different panels to provide explicit control of Z-order. For more details [https://bugs.freepascal.org/view.php?id=32991].<br />
<br />
==Roadmap==<br />
<br />
Located here: [[Roadmap#Status_of_features_on_each_widgetset]]<br />
<br />
[[Category:Mac OS X]]<br />
[[Category:Cocoa]]</div>McSquirrelhttps://wiki.freepascal.org/index.php?title=Installing_Lazarus_on_macOS&diff=123258Installing Lazarus on macOS2019-02-15T19:11:45Z<p>McSquirrel: /* Carbon and Cocoa */</p>
<hr />
<div>{{Platform only|macOS|macOS|macOS}}<br />
{{Installing Lazarus on MacOS X}}<br />
<br />
Installing Lazarus on a Mac is not particularly difficult but it is critical that you do the install in the correct order. Skipping steps will almost certainly lead to tears. In brief, here is what you do -<br />
<br />
# Download and install Xcode.<br />
# Install the global command line tools for Xcode.<br />
# Install Free Pascal Compiler, FPC Source and Lazarus<br />
<br />
<br />
# Note : if installing versions of Lazarus prior to 2.0.0 you almost certainly also need gdb, see in the Legacy section.<br />
<br />
== Installation ==<br />
<br />
The detailed instructions assume a recent version of macOS on you Mac, a recent version of Xcode from Apple and recent version of Lazarus. Further down the page, under Legacy Documentation, you will see older information that may be relevant if you are using older components. You can assist by replacing out of date info, either deleting it, or, if it may help someone working with a legacy project, moving it to the bottom of the page.<br />
<br />
In general, this is about using both the '''Carbon''' and '''Cocoa''' Widget Set. While Carbon may still be seen as more stable, as of release 2.0.0 the 64bit Cocoa is not far behind and certainly should be considered. Carbon is intentionally (by Apple) limited to 32 bits and we have every reason to believe Apple may drop support for it some time in the not too distant future. <br />
<br />
=== Step 1. Download Xcode. === <br />
You need the Apple Developer tools, which are a part of the Xcode development environment. They can be installed from the original macOS installation disks or or a possibly newer copy downloaded from the Apple Developer Connection (ADC), which requires free registration: http://developer.apple.com/ Download the Xcode file, it will end up in your Downloads directory as a xip file. September 2017 it is Xcode_9_beta_6.xip, about 5G. Click it. It is unarchived into your Downloads directory. You may be happy with it there but maybe not. Other users will see the path to it but be unable to use it. And it is untidy there. So I moved mine and then told xcode-select where it was moved to (in a terminal) -<br />
<br />
<syntaxhighlight>mv Downloads/Xcode-beta.app /Developer/.<br />
sudo xcode-select -s /Developer/Xcode-beta.app/Contents/Developer </syntaxhighlight><br />
<br />
=== Step 2. Xcode Command Line Tools ===<br />
This is shown here as a separate step because it really is a separate step in addition to Step 1. Don't confuse this with the internal Xcode command line tools that the Xcode GUI will tell you are already installed. Lazarus cannot use those Xcode internal command line tools, so do the following (it is quick and easy)-<br />
<br />
<syntaxhighlight>xcode-select --install</syntaxhighlight><br />
<br />
Since macOS Mojave you need to install the SDK headers as well:<br />
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg<br />
<br />
<br />
<br />
=== Step 3 FPC, FPC Source and Lazarus (disk images or fink) ===<br />
Get and install, '''in this order''', the FPC, FPC Source, Lazarus. Get release version of all three from Link https://sourceforge.net/projects/lazarus/files . As these install kits are not approved by Apple, you need to hold down the Control key, click the package and choose Open and confirm you want to install from an Unknown Developer (i.e. one who does not pay Apple a kickback).<br />
<br />
Alternatively, you can use [http://finkproject.org/ fink], a package manager for macOS. The extra bonus of fink is easy installation as well as clean removal of a huge number of other open source software packages, including [[Cross_compiling#From_Darwin_to_Windows.2C_Linux_and_others | FreePascal crosscompilers ]] for many processors and systems. The choice for lazarus is between a carbon look of lazarus (preferred by most), a gtk2 look, a Qt4-based and a Qt5-based version:<br />
<br />
$ fink install lazarus-aqua<br />
<br />
or<br />
<br />
$ fink install lazarus-gtk2<br />
<br />
or<br />
<br />
$ fink install lazarus-qt4<br />
<br />
or<br />
<br />
$ fink install lazarus-qt5<br />
<br />
You will be asked, whether to install a number of dependencies, including the FreePascal compiler, the lazarus sources. Simply hit RETURN at the prompt and go for a coffee. It may take quite some time to build all packages, in particular on older Macs.<br />
<br />
After installation, Lazarus can be started from the folder /Applications/Fink/. The actual details of fpc and lazarus are in subdirectories of /sw<br />
<br />
With any lazarus package from fink, these widget sets are supported for your program on macOS:<br />
<br />
carbon (Aqua), gtk2, qt4 (Aqua), qt5 (Aqua), nogui, win32, win64 and wince.<br />
<br />
<br />
Now, try the Run test! The first time in a debugging session, expect a warning and then a login box where you need to enter your password as the debugger starts up. This is annoying but all fine after that.<br />
<br />
For authorative/more detailed instructions for FPC, please go to [http://freepascal.stack.nl/down/i386/macosx-netherlands.html]<br />
<br />
== Compatibility ==<br />
Not every combination of Lazarus and Free Pascal is compatible with every installation of macOS. Please refer to the following table in order to find the correct version for your development environment:<br />
{{Template:Compatibility matrix of Lazarus for Mac}}<br />
<br />
== Carbon and Cocoa ==<br />
At present (late 2017) Lazarus using Carbon is a pretty good experience, things work pretty much as expected. However, it must be remembered that Carbon is intentionally limited (by Apple) to 32 bits and there is every reason to believe it might be dropped altogether in a later release of OSX. The alternatives include Cocoa, QT and GTK2+. The latter two require additional libraries and GTK2+ on the Mac appears to get little attention these days. QT on the Mac does have some strong supporters on the forum.<br />
<br />
However, '''Cocoa''' is generally recognized as the future. It is possible to build an all Cocoa version of Lazarus with release 2.0.0 and later. It is also possible to make a Carbon install of Lazarus and use that to generate Cocoa 64bit binaries. You need to set the Target to the 64bit processor and select the Cocoa Widget set:<br />
<br />
*Open your project with Lazarus and click Project/ProjectOptions<br />
*In the "Config and Target" panel set the "Target CPU family" to be "x86_64"<br />
*In the "Additions and Overrides" panel click on "Set LCLWidgetType" pulldown and set the value to "Cocoa"<br />
*In the past, for some reason Lazarus kept setting the compiler to "/usr/local/bin/ppc386" - which results in 32 bit apps. Make sure under Tools->Options that "Compiler Executable" is set to "/usr/local/bin/fpc" to get 64 bit apps.<br />
*Now compile your project - with any luck it will work OK.<br />
<br />
== Download the sources via svn ==<br />
<br />
The sources are kept in a version control system called subversion or short '''svn''':<br />
<br />
*10.5 and higher already contains svn clients. Users of earlier versions must install SVN for macOS. A good package is provided by [http://www.codingmonkeys.de/mbo/ Martin Ott]. You can also use fink. SVN clients with GUI (graphical user interface) are available from [http://www.versiontracker.com Versiontracker]. A quite handy client, which integrates in Finder, is [http://scplugin.tigris.org SCPlugin].<br />
<br />
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. <br />
First create a directory for fpc <br />
: (e.g. /Users/username/freepascal) <br />
then open a terminal and do the following:<br />
[]$ svn co http://svn.freepascal.org/svn/fpc/trunk fpc<br />
This will create a directory called 'fpc', which can be later used in the IDE.<br />
Hint: To download/update the latest changes you can simply do<br />
[]$ cd /Users/username/freepascal/fpc<br />
[]$ svn up<br />
<br />
Building fpc<br />
[]$ make clean all<br />
[]$ sudo make install<br />
<br />
Then download lazarus<br />
[]$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus<br />
This will create a directory called 'lazarus'.<br />
To update the latest changes:<br />
[]$ cd /Users/username/freepascal/lazarus<br />
[]$ svn up<br />
<br />
Building lazarus<br />
[]$ make clean all<br />
<br />
Then start lazarus either via command line or by double click in the finder:<br />
open lazarus.app<br />
<br />
== Download stable sources ==<br />
<br />
Source code of stable versions is available in the [http://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/ Lazarus Zip - GZip] archives. This is e.g. an option for users, who want to run the latest official Lazarus versions on "unsupported" machines, e.g. PPC-based Macs. Provided that you have installed the latest stable FPC version together with sources, it is sufficient to download and unpack the zip archive. Move it to the desired location (e.g. your /Developer folder), open a terminal window and change the shell's path to this folder (the easiest way to do this is to type "cd " and then to drag the icon of the freshly unpacked Lazarus folder to the position after this command in the Terminal window). If necessary enter <return> and then<br />
[]$ make clean bigide<br />
<br />
and <return> again. Subsequently, FreePascal will use the makefile in this folder to build the Lazarus IDE. This may take a few minutes, but the process is fully automated. Therefore, you might want to look for a cup of coffee, while FPC is working. If the compiler is ready it prints the number of processed lines and the required time to the shell's output.<br />
<br />
The last step is to right-klick on the Lazarus bundle icon and to select "Show Package Contents" from the context menu. Then drag the executable "lazarus" to the folder "Contents/MacOS" of the bundle. That's it.<br />
<br />
= Legacy Information =<br />
<br />
=== Install gdb ===<br />
<br />
As of the Lazarus 2.0.0 release this is entirely optional. The IDE now supports LLDB directly. See http://forum.lazarus-ide.org/index.php/topic,42869.0.html and http://wiki.lazarus.freepascal.org/Lazarus_2.0.0_release_notes#LLDB_based_Debugger_.28New.29<br />
<br />
Getting gdb to run can be a bit tedious but is worthwhile in the end if using Lazarus < V2.0 or have some specific requirement for gdb. You probably don't ! <br />
<br />
This step should be done after installing XCode and before installing FPC/Lazarus.<br />
<br />
# Install fink or brew and use them to install gdb- http://wiki.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5<br />
# Self sign the gdb binary using tools already on your Mac - https://sourceware.org/gdb/wiki/BuildingOnDarwin This is the tedious part. The instructions are clear except, perhaps they could have mentioned that after you have set the Keychain to ’System’ you need click ‘Create’ and ‘Done’ on the next screen. Then go and find the cert in your overall list of certs to do the next instruction “using the contextual menu…”. Don’t worry about step “2.1.4 Disable starting the debuggee…”, we’ll address that once Lazarus itself is installed and working.<br />
# Once Lazarus is installed and fired up, tell it how it should start gdb, that is step 5.<br />
<br />
'''Note''' that as of April 2018, there may be issues with newest gdb and High Sierra. https://forum.lazarus.freepascal.org/index.php/topic,40874.0.html<br />
''According to https://stackoverflow.com/questions/49001329/gdb-doesnt-work-on-macos-high-sierra-10-13-3, gdb 8.1 does not work on High Sierra, but 8.0.1 does.''<br />
<br />
'''Part 2 of gdb install, Tell Lazarus about starting gdb'''<br />
<br />
Again, this step is not necessary with Lazarus V2.0 and Later. See http://wiki.lazarus.freepascal.org/Lazarus_2.0.0_release_notes#LLDB_based_Debugger_.28New.29 If you do install (and use) gdb, you must tell Lazarus about how to call gdb. Obviously, this step happens after Lazarus is installed.<br />
<br />
OK, now you should be able to start Lazarus, it should display the various parts and paths it needs (including gdb) in the little opening screen. You will get an alert there if you chose to not use a debugger. Proceed to the IDE and we now need to tell Lazarus to tell gdb to not open a shell, as noted by a number of Forum people (http://forum.lazarus.freepascal.org/index.php/topic,37310.0.html). Within Lazarus, click Tools->Options->Debugger->General<br />
In the “Debugger specific Options” there is a field labeled Debugger_Startup_Options. Type in "--eval-command=set startup-with-shell off" (including the inverted commas) AND press the return key, click OK. Note you cannot copy and paste into this box (##$!). See screen shot.<br />
<gallery><br />
Image:Debug_Startup_Options_01.png<br />
</gallery><br />
<br />
<br />
=== Xcode Compatability ===<br />
Information relating to older versions of FPC, Lazarus and Apple Developer Tools<br />
<br />
==== Compatibility with Xcode 5.0 and newer versions (Mac OS X 10.8, 10.9, 10.10 and 10.11) ====<br />
Like Xcode 4.3+, Xcode 5 and subsequent versions no longer install the command line tools by default. These are required by FPC/Lazarus, however. Unlike in Xcode 4 the installation option is no longer accessible in Xcode 5 via the Downloads tab. Additionally, the "Locations" tab of the preferences dialog may be confusing, as it mentions that the command line tools are installed:<br />
<br />
<gallery><br />
Image:xcode5 misleading screenshot.png|Default location of command line tools in Xcode 5.<br />
Image:xcode select.png|Installation of command line tools with the xcode-select command part 1...<br />
Image:command line tools installation on mavericks.png|...and part 2.<br />
</gallery><br />
<br />
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:<br />
<syntaxhighlight lang="bash"><br />
xcode-select --install<br />
</syntaxhighlight><br />
<br />
Depending from your Xcode version alternative steps to install the command line developer tools may be to download them directly in the Xcode preferences window (see screenshots above) or to download them from [http://developer.apple.com developer.apple.com] (please take care to install the command line tools that are correct exactly for your Xcode version).<br />
<br />
*You can compile and install the normal gdb. See [[GDB on OS X Mavericks and Xcode 5]].<br />
<br />
==== Xcode 4.3+ compatibility (Mac OS X 10.7/10.8) ====<br />
Xcode 4.3 and later no longer install the command line tools by default. These are required by FPC/Lazarus. <br />
<br />
To install them manually, open Xcode, go to Preferences, select "Downloads;" and install the "Command Line Tools". Afterwards, FPC will install and function correctly.<br />
<br />
<gallery><br />
Image:install command line tools 1.png<br />
Image:install command line tools 2.png<br />
Image:install command line tools 3.png<br />
</gallery><br />
<br />
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). You may also download the command line tools from [https://developer.apple.com/download/more/?=command%20line%20tools Apple Developer].<br />
<br />
==== Xcode 3.2.x compatibility (Mac OS X 10.6) ====<br />
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.<br />
<br />
==== Xcode 3.1.x compatibility (Mac OS X 10.5) ====<br />
Most versions of Lazarus and FPC are compatible with Xcode 3.1 (see the [[#Compatibility|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.<br />
<br />
==== Xcode 2.x compatibility (Mac OS X 10.4) ====<br />
Most versions of Lazarus and FPC are compatible with Xcode 2.3 or newer (see the [[#Compatibility|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. Xcode 2.0 was compatible with Lazarus 0.9.x, but it is no longer supported by newer versions of the Lazarus IDE.<br />
<br />
== Install Packages / Released version ==<br />
<br />
=== Installation from disk images ===<br />
<br />
Download the three disk images (.dmg files) for fpc, fpcsrc and lazarus from either of the following links:<br />
<br />
* [http://sourceforge.net/projects/lazarus/files/Lazarus%20Mac%20OS%20X%20i386/ Intel-based Macs]<br />
* [http://sourceforge.net/projects/lazarus/files/Lazarus%20Mac%20OS%20X%20powerpc/ PowerPC-based Macs]<br />
<br />
Open up each disk image and install in this order:<br />
# fpc<br />
# fpcsrc<br />
# Lazarus<br />
<br />
After installation the Lazarus application can be found in /Developer/lazarus/, the FPC source files in /usr/local/share/fpcsrc.<br />
<br />
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):<br />
<br />
Environment Options<br />
Lazarus directory: /Developer/lazarus<br />
Compiler path: /usr/local/bin/ppc386 (PowerPC Macs: /usr/local/bin/ppcppc)<br />
FPC Source: /usr/local/share/fpcsrc<br />
<br />
Project | Options<br />
All paths blank<br />
LCL Widget Type: default (Carbon beta)<br />
<br />
Project | Inspector<br />
Required Packages<br />
LCL<br />
<br />
Note - different versions of Lazarus depend on particular versions of the FreePascal compiler and will not work with other versions.<br />
<br />
Another common problem is that the versions of fpc and fpcsrc are different.<br />
<br />
This is the easiest way to install Lazarus on Mac OS X.<br />
<br />
== Install from Source / Development version ==<br />
<br />
You need the latest stable released FPC installed in order to compile the development version.<br />
<br />
=== Download and install a compiler ===<br />
<br />
Download and install the FPC package: https://sourceforge.net/project/showfiles.php?group_id=89339<br />
<br />
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 [http://snapshots.lazarus.shikami.org/lazarus/ 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.<br />
<br />
= Uninstalling Lazarus and Free Pascal =<br />
<br />
== Installed using fink ==<br />
<br />
The complete uninstall of all fpc and lazarus packages is done with:<br />
<br />
<syntaxhighlight lang="bash"><br />
fink purge --recursive fpc-config<br />
</syntaxhighlight><br />
<br />
If you want to preserve changes to the preference file /sw/etc/fpc.cfg, do:<br />
<br />
<syntaxhighlight lang="bash"><br />
fink remove --recursive fpc-config<br />
</syntaxhighlight><br />
<br />
For the removal of the Lazarus preference folder and files in your home directory, see below ([[#Lazarus preference folder .lazarus in the home directory | Lazarus preference folder]]).<br />
<br />
== Installed from disk images or sources ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
<syntaxhighlight lang="bash"><br />
bin=/usr/local/bin<br />
share=/usr/local/share<br />
lib=/usr/local/lib<br />
receipts=/Library/Receipts<br />
private=/private/etc<br />
<br />
rm -fv $bin/ppcppc<br />
rm -fv $bin/ppc386<br />
rm -fv $bin/bin2obj<br />
rm -fv $bin/data2inc<br />
rm -fv $bin/delp<br />
rm -fv $bin/fd2pascal<br />
rm -fv $bin/fpc<br />
rm -fv $bin/fpcmake<br />
rm -fv $bin/fpcmkcfg<br />
rm -fv $bin/fpcsubst<br />
rm -fv $bin/fpdoc<br />
rm -fv $bin/fprcp<br />
rm -fv $bin/h2pas<br />
rm -fv $bin/h2paspp<br />
rm -fv $bin/makeskel<br />
rm -fv $bin/mkxmlrpc<br />
rm -fv $bin/plex<br />
rm -fv $bin/postw32<br />
rm -fv $bin/ppdep<br />
rm -fv $bin/ppudump<br />
rm -fv $bin/ppufiles<br />
rm -fv $bin/ppumove<br />
rm -fv $bin/ptop<br />
rm -fv $bin/pyacc<br />
rm -fv $bin/rstconv<br />
rm -fv $bin/unitdiff<br />
rm -r $private/lazarus<br />
rm -r $bin/lazarus<br />
rm -r $share/lazarus<br />
rm -r $share/fpcsrc<br />
rm -r $share/doc/fpc-2.2.2<br />
rm -r $share/examples/fpc-2.2.2<br />
<br />
rm -r $lib/fpc<br />
<br />
rm -r $receipts/lazarus-*.pkg<br />
rm -r $receipts/fpcsrc-*.pkg<br />
rm -r $receipts/fpc-*.pkg<br />
<br />
rm -fv /etc/fpc.cfg<br />
</syntaxhighlight><br />
<br />
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.<br />
<br />
To run this script, change to the directory where it's stored and enter:<br />
<br />
<syntaxhighlight lang="bash"><br />
chmod +x uninstallLaz.sh<br />
sudo ./uninstallLaz.sh<br />
</syntaxhighlight><br />
<br />
Then enter your password when prompted.<br />
<br />
=== Lazarus preference folder .lazarus in the home directory ===<br />
<br />
'''''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. macOS 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:<br />
<br />
<syntaxhighlight lang="bash"><br />
cd ~/<br />
ls -al<br />
cd .lazarus<br />
ls<br />
</syntaxhighlight><br />
<br />
To remove it, execute the following commands:<br />
<br />
<syntaxhighlight lang="bash"><br />
cd ~/<br />
rm -rv .lazarus<br />
</syntaxhighlight><br />
<br />
= Known issues =<br />
<br />
*FPC 2.4.4 has a bug. You can not compile the IDE with the range check flag '''-Cr'''.<br />
*On OS X 10.4 you have to manually uninstall any previous version before installing a new dmg. Delete the following files and folders:<br />
**/Developer/lazarus<br />
**/Library/Receipts/lazarus.pkg<br />
**/etc/lazarus<br />
**/usr/local/bin/lazbuild<br />
<br />
= See Also =<br />
<br />
* [[Mac Installation FAQ]]<br />
<br />
==Other Interfaces==<br />
{{Interfaces}}<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips.<br />
<br />
===Mac How To Articles===<br />
* [http://www.mac-how.net Mac How] - If you having troubles in solving some major issues.<br />
<br />
===Interfaces Development Articles===<br />
*[[Carbon interface internals]] - If you want to help improving the Carbon interface<br />
*[[Windows CE Development Notes]] - For Pocket PC and Smartphones<br />
*[[Adding a new interface]] - How to add a new widget set interface<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[LCL Internals]] - Some info about the inner workings of the LCL<br />
<br />
[[Category:Mac OS X]]<br />
[[Category:Install]]<br />
[[Category:Lazarus]]</div>McSquirrelhttps://wiki.freepascal.org/index.php?title=Installing_Lazarus_on_macOS&diff=123177Installing Lazarus on macOS2019-02-10T18:16:22Z<p>McSquirrel: /* Carbon and Cocoa */ added instructions for compiling Cocoa 64bit apps</p>
<hr />
<div>{{Platform only|macOS|macOS|macOS}}<br />
{{Installing Lazarus on MacOS X}}<br />
<br />
Installing Lazarus on a Mac is not particularly difficult but it is critical that you do the install in the correct order. Skipping steps will almost certainly lead to tears. In brief, here is what you do -<br />
<br />
# Download and install Xcode.<br />
# Install the global command line tools for Xcode.<br />
# Install Free Pascal Compiler, FPC Source and Lazarus<br />
<br />
<br />
# Note : if installing versions of Lazarus prior to 2.0.0 you almost certainly also need gdb, see in the Legacy section.<br />
<br />
== Installation ==<br />
<br />
The detailed instructions assume a recent version of macOS on you Mac, a recent version of Xcode from Apple and recent version of Lazarus. Further down the page, under Legacy Documentation, you will see older information that may be relevant if you are using older components. You can assist by replacing out of date info, either deleting it, or, if it may help someone working with a legacy project, moving it to the bottom of the page.<br />
<br />
In general, this is about using both the '''Carbon''' and '''Cocoa''' Widget Set. While Carbon may still be seen as more stable, as of release 2.0.0 the 64bit Cocoa is not far behind and certainly should be considered. Carbon is intentionally (by Apple) limited to 32 bits and we have every reason to believe Apple may drop support for it some time in the not too distant future. <br />
<br />
=== Step 1. Download Xcode. === <br />
You need the Apple Developer tools, which are a part of the Xcode development environment. They can be installed from the original macOS installation disks or or a possibly newer copy downloaded from the Apple Developer Connection (ADC), which requires free registration: http://developer.apple.com/ Download the Xcode file, it will end up in your Downloads directory as a xip file. September 2017 it is Xcode_9_beta_6.xip, about 5G. Click it. It is unarchived into your Downloads directory. You may be happy with it there but maybe not. Other users will see the path to it but be unable to use it. And it is untidy there. So I moved mine and then told xcode-select where it was moved to (in a terminal) -<br />
<br />
<syntaxhighlight>mv Downloads/Xcode-beta.app /Developer/.<br />
sudo xcode-select -s /Developer/Xcode-beta.app/Contents/Developer </syntaxhighlight><br />
<br />
=== Step 2. Xcode Command Line Tools ===<br />
This is shown here as a separate step because it really is a separate step in addition to Step 1. Don't confuse this with the internal Xcode command line tools that the Xcode GUI will tell you are already installed. Lazarus cannot use those Xcode internal command line tools, so do the following (it is quick and easy)-<br />
<br />
<syntaxhighlight>xcode-select --install</syntaxhighlight><br />
<br />
Since macOS Mojave you need to install the SDK headers as well:<br />
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg<br />
<br />
<br />
<br />
=== Step 3 FPC, FPC Source and Lazarus (disk images or fink) ===<br />
Get and install, '''in this order''', the FPC, FPC Source, Lazarus. Get release version of all three from Link https://sourceforge.net/projects/lazarus/files . As these install kits are not approved by Apple, you need to hold down the Control key, click the package and choose Open and confirm you want to install from an Unknown Developer (i.e. one who does not pay Apple a kickback).<br />
<br />
Alternatively, you can use [http://finkproject.org/ fink], a package manager for macOS. The extra bonus of fink is easy installation as well as clean removal of a huge number of other open source software packages, including [[Cross_compiling#From_Darwin_to_Windows.2C_Linux_and_others | FreePascal crosscompilers ]] for many processors and systems. The choice for lazarus is between a carbon look of lazarus (preferred by most), a gtk2 look, a Qt4-based and a Qt5-based version:<br />
<br />
$ fink install lazarus-aqua<br />
<br />
or<br />
<br />
$ fink install lazarus-gtk2<br />
<br />
or<br />
<br />
$ fink install lazarus-qt4<br />
<br />
or<br />
<br />
$ fink install lazarus-qt5<br />
<br />
You will be asked, whether to install a number of dependencies, including the FreePascal compiler, the lazarus sources. Simply hit RETURN at the prompt and go for a coffee. It may take quite some time to build all packages, in particular on older Macs.<br />
<br />
After installation, Lazarus can be started from the folder /Applications/Fink/. The actual details of fpc and lazarus are in subdirectories of /sw<br />
<br />
With any lazarus package from fink, these widget sets are supported for your program on macOS:<br />
<br />
carbon (Aqua), gtk2, qt4 (Aqua), qt5 (Aqua), nogui, win32, win64 and wince.<br />
<br />
<br />
Now, try the Run test! The first time in a debugging session, expect a warning and then a login box where you need to enter your password as the debugger starts up. This is annoying but all fine after that.<br />
<br />
For authorative/more detailed instructions for FPC, please go to [http://freepascal.stack.nl/down/i386/macosx-netherlands.html]<br />
<br />
== Compatibility ==<br />
Not every combination of Lazarus and Free Pascal is compatible with every installation of macOS. Please refer to the following table in order to find the correct version for your development environment:<br />
{{Template:Compatibility matrix of Lazarus for Mac}}<br />
<br />
== Carbon and Cocoa ==<br />
At present (late 2017) Lazarus using Carbon is a pretty good experience, things work pretty much as expected. However, it must be remembered that Carbon is intentionally limited (by Apple) to 32 bits and there is every reason to believe it might be dropped altogether in a later release of OSX. The alternatives include Cocoa, QT and GTK2+. The latter two require additional libraries and GTK2+ on the Mac appears to get little attention these days. QT on the Mac does have some strong supporters on the forum.<br />
<br />
However, '''Cocoa''' is generally recognized as the future. It is possible to build an all Cocoa version of Lazarus with release 2.0.0 and later. It is also possible to make a Carbon install of Lazarus and use that to generate Cocoa 64bit binaries. You need to set the Target to the 64bit processor and select the Cocoa Widget set:<br />
<br />
*Open your project with Lazarus and click Project/ProjectOptions<br />
*In the "Config and Target" panel set the "Target CPU family" to be "x86_64"<br />
*In the "Additions and Overrides" panel click on "Set LCLWidgetType" pulldown and set the value to "Cocoa"<br />
*In the past, for some reason my Lazarus kept setting the compiler to "/usr/local/bin/ppc386" - which results in 32 bit apps. Make sure under Tools->Options that "Compiler Executable" is set to "/usr/local/bin/fpc" to get 64 bit apps.<br />
*Now compile your project - with any luck it will work OK.<br />
<br />
== Download the sources via svn ==<br />
<br />
The sources are kept in a version control system called subversion or short '''svn''':<br />
<br />
*10.5 and higher already contains svn clients. Users of earlier versions must install SVN for macOS. A good package is provided by [http://www.codingmonkeys.de/mbo/ Martin Ott]. You can also use fink. SVN clients with GUI (graphical user interface) are available from [http://www.versiontracker.com Versiontracker]. A quite handy client, which integrates in Finder, is [http://scplugin.tigris.org SCPlugin].<br />
<br />
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. <br />
First create a directory for fpc <br />
: (e.g. /Users/username/freepascal) <br />
then open a terminal and do the following:<br />
[]$ svn co http://svn.freepascal.org/svn/fpc/trunk fpc<br />
This will create a directory called 'fpc', which can be later used in the IDE.<br />
Hint: To download/update the latest changes you can simply do<br />
[]$ cd /Users/username/freepascal/fpc<br />
[]$ svn up<br />
<br />
Building fpc<br />
[]$ make clean all<br />
[]$ sudo make install<br />
<br />
Then download lazarus<br />
[]$ svn co http://svn.freepascal.org/svn/lazarus/trunk lazarus<br />
This will create a directory called 'lazarus'.<br />
To update the latest changes:<br />
[]$ cd /Users/username/freepascal/lazarus<br />
[]$ svn up<br />
<br />
Building lazarus<br />
[]$ make clean all<br />
<br />
Then start lazarus either via command line or by double click in the finder:<br />
open lazarus.app<br />
<br />
== Download stable sources ==<br />
<br />
Source code of stable versions is available in the [http://sourceforge.net/projects/lazarus/files/Lazarus%20Zip%20_%20GZip/ Lazarus Zip - GZip] archives. This is e.g. an option for users, who want to run the latest official Lazarus versions on "unsupported" machines, e.g. PPC-based Macs. Provided that you have installed the latest stable FPC version together with sources, it is sufficient to download and unpack the zip archive. Move it to the desired location (e.g. your /Developer folder), open a terminal window and change the shell's path to this folder (the easiest way to do this is to type "cd " and then to drag the icon of the freshly unpacked Lazarus folder to the position after this command in the Terminal window). If necessary enter <return> and then<br />
[]$ make clean bigide<br />
<br />
and <return> again. Subsequently, FreePascal will use the makefile in this folder to build the Lazarus IDE. This may take a few minutes, but the process is fully automated. Therefore, you might want to look for a cup of coffee, while FPC is working. If the compiler is ready it prints the number of processed lines and the required time to the shell's output.<br />
<br />
The last step is to right-klick on the Lazarus bundle icon and to select "Show Package Contents" from the context menu. Then drag the executable "lazarus" to the folder "Contents/MacOS" of the bundle. That's it.<br />
<br />
= Legacy Information =<br />
<br />
=== Install gdb ===<br />
<br />
As of the Lazarus 2.0.0 release this is entirely optional. The IDE now supports LLDB directly. See http://forum.lazarus-ide.org/index.php/topic,42869.0.html and http://wiki.lazarus.freepascal.org/Lazarus_2.0.0_release_notes#LLDB_based_Debugger_.28New.29<br />
<br />
Getting gdb to run can be a bit tedious but is worthwhile in the end if using Lazarus < V2.0 or have some specific requirement for gdb. You probably don't ! <br />
<br />
This step should be done after installing XCode and before installing FPC/Lazarus.<br />
<br />
# Install fink or brew and use them to install gdb- http://wiki.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5<br />
# Self sign the gdb binary using tools already on your Mac - https://sourceware.org/gdb/wiki/BuildingOnDarwin This is the tedious part. The instructions are clear except, perhaps they could have mentioned that after you have set the Keychain to ’System’ you need click ‘Create’ and ‘Done’ on the next screen. Then go and find the cert in your overall list of certs to do the next instruction “using the contextual menu…”. Don’t worry about step “2.1.4 Disable starting the debuggee…”, we’ll address that once Lazarus itself is installed and working.<br />
# Once Lazarus is installed and fired up, tell it how it should start gdb, that is step 5.<br />
<br />
'''Note''' that as of April 2018, there may be issues with newest gdb and High Sierra. https://forum.lazarus.freepascal.org/index.php/topic,40874.0.html<br />
''According to https://stackoverflow.com/questions/49001329/gdb-doesnt-work-on-macos-high-sierra-10-13-3, gdb 8.1 does not work on High Sierra, but 8.0.1 does.''<br />
<br />
'''Part 2 of gdb install, Tell Lazarus about starting gdb'''<br />
<br />
Again, this step is not necessary with Lazarus V2.0 and Later. See http://wiki.lazarus.freepascal.org/Lazarus_2.0.0_release_notes#LLDB_based_Debugger_.28New.29 If you do install (and use) gdb, you must tell Lazarus about how to call gdb. Obviously, this step happens after Lazarus is installed.<br />
<br />
OK, now you should be able to start Lazarus, it should display the various parts and paths it needs (including gdb) in the little opening screen. You will get an alert there if you chose to not use a debugger. Proceed to the IDE and we now need to tell Lazarus to tell gdb to not open a shell, as noted by a number of Forum people (http://forum.lazarus.freepascal.org/index.php/topic,37310.0.html). Within Lazarus, click Tools->Options->Debugger->General<br />
In the “Debugger specific Options” there is a field labeled Debugger_Startup_Options. Type in "--eval-command=set startup-with-shell off" (including the inverted commas) AND press the return key, click OK. Note you cannot copy and paste into this box (##$!). See screen shot.<br />
<gallery><br />
Image:Debug_Startup_Options_01.png<br />
</gallery><br />
<br />
<br />
=== Xcode Compatability ===<br />
Information relating to older versions of FPC, Lazarus and Apple Developer Tools<br />
<br />
==== Compatibility with Xcode 5.0 and newer versions (Mac OS X 10.8, 10.9, 10.10 and 10.11) ====<br />
Like Xcode 4.3+, Xcode 5 and subsequent versions no longer install the command line tools by default. These are required by FPC/Lazarus, however. Unlike in Xcode 4 the installation option is no longer accessible in Xcode 5 via the Downloads tab. Additionally, the "Locations" tab of the preferences dialog may be confusing, as it mentions that the command line tools are installed:<br />
<br />
<gallery><br />
Image:xcode5 misleading screenshot.png|Default location of command line tools in Xcode 5.<br />
Image:xcode select.png|Installation of command line tools with the xcode-select command part 1...<br />
Image:command line tools installation on mavericks.png|...and part 2.<br />
</gallery><br />
<br />
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:<br />
<syntaxhighlight lang="bash"><br />
xcode-select --install<br />
</syntaxhighlight><br />
<br />
Depending from your Xcode version alternative steps to install the command line developer tools may be to download them directly in the Xcode preferences window (see screenshots above) or to download them from [http://developer.apple.com developer.apple.com] (please take care to install the command line tools that are correct exactly for your Xcode version).<br />
<br />
*You can compile and install the normal gdb. See [[GDB on OS X Mavericks and Xcode 5]].<br />
<br />
==== Xcode 4.3+ compatibility (Mac OS X 10.7/10.8) ====<br />
Xcode 4.3 and later no longer install the command line tools by default. These are required by FPC/Lazarus. <br />
<br />
To install them manually, open Xcode, go to Preferences, select "Downloads;" and install the "Command Line Tools". Afterwards, FPC will install and function correctly.<br />
<br />
<gallery><br />
Image:install command line tools 1.png<br />
Image:install command line tools 2.png<br />
Image:install command line tools 3.png<br />
</gallery><br />
<br />
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). You may also download the command line tools from [https://developer.apple.com/download/more/?=command%20line%20tools Apple Developer].<br />
<br />
==== Xcode 3.2.x compatibility (Mac OS X 10.6) ====<br />
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.<br />
<br />
==== Xcode 3.1.x compatibility (Mac OS X 10.5) ====<br />
Most versions of Lazarus and FPC are compatible with Xcode 3.1 (see the [[#Compatibility|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.<br />
<br />
==== Xcode 2.x compatibility (Mac OS X 10.4) ====<br />
Most versions of Lazarus and FPC are compatible with Xcode 2.3 or newer (see the [[#Compatibility|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. Xcode 2.0 was compatible with Lazarus 0.9.x, but it is no longer supported by newer versions of the Lazarus IDE.<br />
<br />
== Install Packages / Released version ==<br />
<br />
=== Installation from disk images ===<br />
<br />
Download the three disk images (.dmg files) for fpc, fpcsrc and lazarus from either of the following links:<br />
<br />
* [http://sourceforge.net/projects/lazarus/files/Lazarus%20Mac%20OS%20X%20i386/ Intel-based Macs]<br />
* [http://sourceforge.net/projects/lazarus/files/Lazarus%20Mac%20OS%20X%20powerpc/ PowerPC-based Macs]<br />
<br />
Open up each disk image and install in this order:<br />
# fpc<br />
# fpcsrc<br />
# Lazarus<br />
<br />
After installation the Lazarus application can be found in /Developer/lazarus/, the FPC source files in /usr/local/share/fpcsrc.<br />
<br />
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):<br />
<br />
Environment Options<br />
Lazarus directory: /Developer/lazarus<br />
Compiler path: /usr/local/bin/ppc386 (PowerPC Macs: /usr/local/bin/ppcppc)<br />
FPC Source: /usr/local/share/fpcsrc<br />
<br />
Project | Options<br />
All paths blank<br />
LCL Widget Type: default (Carbon beta)<br />
<br />
Project | Inspector<br />
Required Packages<br />
LCL<br />
<br />
Note - different versions of Lazarus depend on particular versions of the FreePascal compiler and will not work with other versions.<br />
<br />
Another common problem is that the versions of fpc and fpcsrc are different.<br />
<br />
This is the easiest way to install Lazarus on Mac OS X.<br />
<br />
== Install from Source / Development version ==<br />
<br />
You need the latest stable released FPC installed in order to compile the development version.<br />
<br />
=== Download and install a compiler ===<br />
<br />
Download and install the FPC package: https://sourceforge.net/project/showfiles.php?group_id=89339<br />
<br />
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 [http://snapshots.lazarus.shikami.org/lazarus/ 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.<br />
<br />
= Uninstalling Lazarus and Free Pascal =<br />
<br />
== Installed using fink ==<br />
<br />
The complete uninstall of all fpc and lazarus packages is done with:<br />
<br />
<syntaxhighlight lang="bash"><br />
fink purge --recursive fpc-config<br />
</syntaxhighlight><br />
<br />
If you want to preserve changes to the preference file /sw/etc/fpc.cfg, do:<br />
<br />
<syntaxhighlight lang="bash"><br />
fink remove --recursive fpc-config<br />
</syntaxhighlight><br />
<br />
For the removal of the Lazarus preference folder and files in your home directory, see below ([[#Lazarus preference folder .lazarus in the home directory | Lazarus preference folder]]).<br />
<br />
== Installed from disk images or sources ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
<syntaxhighlight lang="bash"><br />
bin=/usr/local/bin<br />
share=/usr/local/share<br />
lib=/usr/local/lib<br />
receipts=/Library/Receipts<br />
private=/private/etc<br />
<br />
rm -fv $bin/ppcppc<br />
rm -fv $bin/ppc386<br />
rm -fv $bin/bin2obj<br />
rm -fv $bin/data2inc<br />
rm -fv $bin/delp<br />
rm -fv $bin/fd2pascal<br />
rm -fv $bin/fpc<br />
rm -fv $bin/fpcmake<br />
rm -fv $bin/fpcmkcfg<br />
rm -fv $bin/fpcsubst<br />
rm -fv $bin/fpdoc<br />
rm -fv $bin/fprcp<br />
rm -fv $bin/h2pas<br />
rm -fv $bin/h2paspp<br />
rm -fv $bin/makeskel<br />
rm -fv $bin/mkxmlrpc<br />
rm -fv $bin/plex<br />
rm -fv $bin/postw32<br />
rm -fv $bin/ppdep<br />
rm -fv $bin/ppudump<br />
rm -fv $bin/ppufiles<br />
rm -fv $bin/ppumove<br />
rm -fv $bin/ptop<br />
rm -fv $bin/pyacc<br />
rm -fv $bin/rstconv<br />
rm -fv $bin/unitdiff<br />
rm -r $private/lazarus<br />
rm -r $bin/lazarus<br />
rm -r $share/lazarus<br />
rm -r $share/fpcsrc<br />
rm -r $share/doc/fpc-2.2.2<br />
rm -r $share/examples/fpc-2.2.2<br />
<br />
rm -r $lib/fpc<br />
<br />
rm -r $receipts/lazarus-*.pkg<br />
rm -r $receipts/fpcsrc-*.pkg<br />
rm -r $receipts/fpc-*.pkg<br />
<br />
rm -fv /etc/fpc.cfg<br />
</syntaxhighlight><br />
<br />
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.<br />
<br />
To run this script, change to the directory where it's stored and enter:<br />
<br />
<syntaxhighlight lang="bash"><br />
chmod +x uninstallLaz.sh<br />
sudo ./uninstallLaz.sh<br />
</syntaxhighlight><br />
<br />
Then enter your password when prompted.<br />
<br />
=== Lazarus preference folder .lazarus in the home directory ===<br />
<br />
'''''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. macOS 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:<br />
<br />
<syntaxhighlight lang="bash"><br />
cd ~/<br />
ls -al<br />
cd .lazarus<br />
ls<br />
</syntaxhighlight><br />
<br />
To remove it, execute the following commands:<br />
<br />
<syntaxhighlight lang="bash"><br />
cd ~/<br />
rm -rv .lazarus<br />
</syntaxhighlight><br />
<br />
= Known issues =<br />
<br />
*FPC 2.4.4 has a bug. You can not compile the IDE with the range check flag '''-Cr'''.<br />
*On OS X 10.4 you have to manually uninstall any previous version before installing a new dmg. Delete the following files and folders:<br />
**/Developer/lazarus<br />
**/Library/Receipts/lazarus.pkg<br />
**/etc/lazarus<br />
**/usr/local/bin/lazbuild<br />
<br />
= See Also =<br />
<br />
* [[Mac Installation FAQ]]<br />
<br />
==Other Interfaces==<br />
{{Interfaces}}<br />
<br />
===Platform specific Tips===<br />
*[[OS X Programming Tips]] - Lazarus installation, useful tools, Unix commands, and more...<br />
*[[WinCE Programming Tips]] - Using the telephone API, sending SMSes, and more...<br />
*[[Windows Programming Tips]] - Desktop Windows programming tips.<br />
<br />
===Mac How To Articles===<br />
* [http://www.mac-how.net Mac How] - If you having troubles in solving some major issues.<br />
<br />
===Interfaces Development Articles===<br />
*[[Carbon interface internals]] - If you want to help improving the Carbon interface<br />
*[[Windows CE Development Notes]] - For Pocket PC and Smartphones<br />
*[[Adding a new interface]] - How to add a new widget set interface<br />
*[[LCL Defines]] - Choosing the right options to recompile LCL<br />
*[[LCL Internals]] - Some info about the inner workings of the LCL<br />
<br />
[[Category:Mac OS X]]<br />
[[Category:Install]]<br />
[[Category:Lazarus]]</div>McSquirrelhttps://wiki.freepascal.org/index.php?title=User:McSquirrel&diff=120170User:McSquirrel2018-10-07T17:05:38Z<p>McSquirrel: Created page with "* Author of [https://www.manelu.de/mcsquirrel/de/software/d_dda.htm Datei-Datums-Änderer] (written in Delphi 6 Personal Edition) * macOS, Linux, Windows * de, en, (nl)"</p>
<hr />
<div>* Author of [https://www.manelu.de/mcsquirrel/de/software/d_dda.htm Datei-Datums-Änderer] (written in Delphi 6 Personal Edition)<br />
* macOS, Linux, Windows<br />
* de, en, (nl)</div>McSquirrelhttps://wiki.freepascal.org/index.php?title=Qt5_Interface&diff=120169Qt5 Interface2018-10-07T16:53:51Z<p>McSquirrel: Added macOS quick start guide.</p>
<hr />
<div>{{Platform only|Qt|Qt|Qt5 widgetset}}<br />
<br />
== Introduction ==<br />
This interface is based on Qt 5 (Qt 5.6.2 is tested). For documentation, fixes and download, go to [http://qt-project.org/ Qt Project] (Installers at [http://download.qt.io/archive/qt/5.6 download 5.6.2]). Lazarus with Qt5 interface (qt5-lcl) can be used on Windows 32/64, Linux x32/x64/arm, MacOSX x64(Cocoa). Qt5 widgetset is available from lazarus trunk 1.7 rev. 53806 and will be available in lazarus 1.8 stable release. There's no support for 32bit Qt5 binary versions from Digia, so if you need 32bit Qt5 on linux you must build complete Qt5 on your own, including libQt5Pas.<br />
<br />
== Quick start guide for Linux ==<br />
Bindings sources are located in lcl/interfaces/qt5/cbindings , to build it just follow README.txt.<br />
<br />
== Step-by-step guide for macOS 64bit ==<br />
The following steps have been tested with macOS 10.13.6 (High Sierra), Xcode command line tools 10.0.0 (no Xcode required), Lazarus 1.8.4 and Qt 5.6.2.<br />
<br />
After installing Qt 5.6.2 (see above), open up a terminal window and run these commands (paths may vary):<br />
<br />
<pre><br />
LazarusDir=/Developer/Lazarus<br />
QtDir=~/Qt5.6.2<br />
cd $LazarusDir/lcl/interfaces/qt5/cbindings<br />
PATH=$QtDir/5.6/clang_64/bin:$PATH<br />
qmake<br />
</pre><br />
<br />
'''If <code>qmake</code> fails''' with the following error:<br />
<br />
<pre><br />
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance<br />
</pre><br />
<br />
'''it does not''' mean that you have to install Xcode. See [https://gist.github.com/shoogle/750a330c851bd1a924dfe1346b0b4a08 Qt without Xcode] for a workaround and try running <code>qmake</code> again. (The Xcode dependency seems to be fixed in Qt 5.9.4 or maybe earlier.)<br />
<br />
Proceed the build process with the following commands:<br />
<br />
<pre><br />
make<br />
make install<br />
</pre><br />
<br />
It may be helpful to add symlinks to the Qt5Pas.framework and other *.framework files (so no modifications to the path are required):<br />
<br />
<pre><br />
cd /Library/Frameworks/<br />
sudo ln -s $QtDir/5.6/clang_64/lib/*.framework .<br />
</pre><br />
<br />
Remember that Qt5 is 64bit, so in Lazarus under Tools - Options - Environment, you need to change Compiler Executable from <code>/usr/local/bin/ppc386</code> to <code>/usr/local/bin/ppcx64</code> . With ppc386, you would later get the following errors when compiling your Lazarus projects:<br />
<br />
<pre><br />
Error: linker: Undefined symbols for architecture i386:<br />
Error: linker: "_QAbstractButton_click", referenced from:<br />
[...]<br />
ld: symbol(s) not found for architecture i386<br />
</pre><br />
<br />
Finally, create a new Lazarus project (or open an existing one), open Project - Project options - Compiler options - Additions and overrides, set <code>LCLWidgetType:=qt5</code> . You should now be able to compile your project with the Qt5 widget set.<br />
<br />
See [https://tondrej.blogspot.com/2018/04/first-steps-with-lazarus-qt5-interface.html] for an example project.<br />
<br />
{{Other Interfaces}}</div>McSquirrel