Forewarning: Installing Object Pascal on a Mac is a bit more difficult than instaling on Windows. If you have a Windows system available we recommend that you try to use it instead at least to get started.
A number of implementations of Object Pascal exist as well as a number of different dialects for the language itself. We use the Delphi/Free Pascal dialect in this book. Delphi is a commercial implementation although student versions can sometimes be purchased at reduced prices. Free Pascal is as the name states both free as in price and free as in open source. For these reasons we recommend using the Free Pascal compiler. Most modern compilers are packaged in what are known as Integrated Development Environments (IDE). These environments provide features such as syntax highlighting, one-click compiling, and step-through-code debugging to name a few. We recommend using the Lazarus IDE which contains the Free Pascal Compiler. Follow these instructions to install Lazarus on your machine:
1. While the latest version of the Lazarus IDE can be downloaded from
Source Forge, we recommend using version 0.9.28.2 (a direct link is provided below). One warning about some of these links is that SourceForge often has annoying ads that may ask you to fill out registration information. You DO NOT need to do this. The download should start immediately from these links. If it does not there is usually a link on the page that is a manual download link, but you shouldn't have to enter any information in order to download lazarus.
Lazarus runs on a wide number of systems so you will need to know exactly what platform you have in order to download the right installer. You have an Intel Mac if you bought your Mac after 2006. If you bought it during 2006 you might need to check, but it's very likely that you have an Intel Mac. If you bought your computer before 2006 you probably have a PowerPC architecture. While Lazarus, supports PowerPC and you can download it manually, we recommend using a more recent platform. For an Intel Mac, you will need all three of the following files:
FPC Binary for Intel Mac
FPC Source for Intel Mac
Lazarus for Intel Mac
If these links do not work automatically (or if you have a PowerPC Mac), then go to this directory and find the correct version manually:
Lazarus Project Directory
Make sure you know where the file is downloaded to on your computer so you can open it in the next step.
3. Follow the instructions found at
Installing Lazarus on MacOSX
4. When installation is complete, download
this file and unzip it onto your desktop (or any other location where you would like to store your files). The unzipped directory contains the basic files you will need to get started. You will also place all project files you create in this directory.
5. To test your Lazarus installation, open the folder GettingStarted in Unit 1 of the Introduction_to_Computer_Programming directory. Double click on either GettingStarted.lpr or GettingStarted.lpi (both do the same thing). The first thing you probably want to do is change some of the environment options. Automatic backup files are optional but often get in the way so we can stop automatic backups by selecting Environment -> Options on the main menu. The window that opens should look something like the window below. You should select Backup under Environment. On both the project files and other files sections you should change the value from backup to (no subdirectory) and the type from User defined to No backup files.
Next you should select Colors under Editor. This will allow us to adjust the syntax highlighting to the highlighting theme that is used in this book. Use the following table to adjust each component of the language to the right color and style:
Object Pascal | Foreground | Style |
Assembler | Green | Bold |
Comment | Navy | Italic |
Directive | Navy | Bold |
Identifier | Black | None |
Number | Red | None |
Reserved word | Maroon | Bold |
String | Blue | None |
Symbol | Black | None |
If all of this was done correctly, the editor should look like this:
Finally, we can disable Code Folding under Editor by unchecking the Code folding box since we will not use code folding in this unit.
6. To ensure that all is well. Click the green triangle button below the main menu or press F9 assuming you are using the default key shortcut mappings. A console window should appear with the following lines:
Welcome to Object Pascal in Lazarus! The answer to life, the universe, and everything = 42
If this works you should be able to return to Chapter 1 and continue from where you left off. If any of these steps fails you should review these instructions to make sure all steps were taken correctly. If the issue seems to be with the installation of FreePascal then refer to the contact email address on FreeText.org for help.