Most of these steps are done at the command line in a Terminal window, so start by running the Terminal app in /Applications/Utilities. Note that you can copy and paste any of the commands given below into the Terminal window to avoid typing them yourself.
Create a folder somewhere and check out the code. For example:
mkdir laz-svn cd laz-svn svn checkout https://svn.freepascal.org/svn/lazarus/trunk .This may take a while, but it's just source code. Nothing is being installed.
make LCL_PLATFORM=cocoa CPU_TARGET=x86_64
open lazarus.app --args "--pcp=~/.laz-svn"You can substitute a different name for the config folder path ("pcp"). Don't use ~/.lazarus since that's the default for your existing Lazarus installation. The leading period (.) means the folder will be hidden -- omit the period if you don't want your config folder to be hidden, for example so you can easily delete it later.
Note: Since the Cocoa widgetset is incomplete, the Lazarus IDE built with Cocoa isn't complete either. It should start okay and you can play around with it to see what's working and what's not, but you might just want to exit at this point. You only need to run it once to create the config folder.
First download and unzip the source:
https://macpgmr.github.io/MacXPlatform/lclwebbrowser-src.zip
Now change to where you unzipped the source and compile it with the Lazarus lazbuild command. The lazbuild command was built when the Cocoa IDE was built, so substitute the path to your own checkout folder. Also make sure that the --pcp switch points to your config folder created above when you ran the Cocoa IDE.
~/laz-svn/lazbuild --pcp=~/.laz-svn --ws=cocoa --compiler=/usr/local/bin/ppcx64 --cpu=x86_64 webbrowserpackage.lpk
Even though only Cocoa support is implemented currently in TWebBrowser, you can still install and use the control for designing a form in Lazarus on any platform, including the 32-bit Carbon IDE.
This will add TWebBrowser to the Common Controls palette.
Create a new project in Lazarus and add a TWebControl to the form. Then call the control's LoadPage method, passing in the URL of a site to load. For example:
procedure TForm1.Button1Click(Sender: TObject); begin WebBrowser1.LoadPage('https://www.lazarus-ide.org'); end;Compile and run the app. You won't see anything in the control's area of the form since only Cocoa is currently supported -- this is normal.
Now compile the app for 64-bit Cocoa from the command line. For example:
~/laz-svn/lazbuild --pcp=~/.laz-svn --ws=cocoa --compiler=/usr/local/bin/ppcx64 --cpu=x86_64 project1.lpiAgain, substitute your own path to lazbuild and your own config folder. And if you used a different name for your project info file, substitute for project1.lpi too.
lldb project1.app runOnce you've quit the app, exit the debugger:
exitYou can also run the app by double-clicking it in Finder.
macpgmr (at) icloud (dot) com
First posted July 5, 2017.