# Talk:Installing Lazarus on MacOS X

This is a draft of a new "top half" for the main page. Its about getting a recent version of lazarus going on a recent version of OSX. I need to get a lot of formatting done and a polite way to tuck the historical data down the bottom. Note there is absolutely nothing new from me here, its all stuff scattered across the forum and wiki. I'll be back ....

David

Installing Lazarus on a Mac is not particularly difficult but is a bit tedious. Its 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 -

2. Install the global command line tools for Xcode.
3. Install gdb - sort of but not really optional.
4. Install Free Pascal Compiler, FPC Source and Lazarus
5. Speak to Lazarus about gdb.

The detailed instructions assume a recent version of OSX 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 bottom of the page.

In general, this is about using the Carbon Widget Set, it 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. The alternative is Cocoa, more information to be provided.

mv Downloads/Xcode-beta.app /Developer/.
sudo xcode-select -s /Developer/Xcode-beta.app/Contents/Developer

#### Step 2. Xcode Command Line Tools

This is shown here as a separate step because it 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 (its quick and easy)-

Xcode-select —install

#### Step 3 install gdb

While this is really optional, I suggest you do need gdb in most cases and I recommend this step. Alternatives include -

Getting gdb to run can be a bit tedious but is worthwhile in the end. I recommend this approach

1. Install brew and use brew to install gdb- http://wiki.freepascal.org/GDB_on_OS_X_Mavericks_and_Xcode_5
2. 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.
3. Once Lazarus is installed and fired up, tell it how it should start gdb, that is step 5.

#### Step 4 FPC, FPC Source and Lazarus

Get and install, in this order, the FPC, FPC Source, Lazarus. I used Lazarus 1.8rc4, its very mature and probably about to become 1.8 pretty soon. Get 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).

#### Step 5 Tell Lazarus about starting gdb

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 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.

Now, try the Run test ! The first time in a debugging session, expect a warning and then a logon box where you need put in your password as the debugger starts up. Annoying but its all fine after that.