Cài free pascal trên mac

Free Pascal Download Link - Similar to Turbo Pascal & Delphi for Windows Mac & Linux

The Free Pascal Compiler is an open source compiler that is similar to Turbo Pascal. The Lazarus IDE is similar to Delphi. Pascal was originally designed as a teaching language for computers, but it can be used to create commercial software and...

schoolfreeware.com

Download Mac OS X for Intel

This version The latest release version is 3.2.2

"Unknown developer" error when installing (Mac OS X 10.7 and later)

If you get the message that the FPC installer was created by an unknown developer and cannot be opened, right-click (or ctrl-click) on the installation package and choose "Open" in the contextual menu. If this does not work, you may first have to go to "System Preferences" -> "Security & Privacy" -> "General", and "Allow apps downloaded from: Mac App Store and Identified developers". These workarounds are required because we do not pay Apple 99 euro per year, which would prove you can trust us.

Xcode 11+ compatibility (macOS 10.15 Catalina and later)

FPC 3.2.2 is qualified for use with Mac OS X 10.4 till macOS 11. Xcode 11+ no longer includes support for compiling Intel 32 bit programs. If you wish to compile such programs, you will have to copy an older Mac OS X SDK from a previous Xcode installation and point the compiler to it with the -XR command line parameter.

Xcode 10+ compatibility (macOS 10.14 Mojave and later)

FPC 3.2.2 is qualified for use with Mac OS X 10.4 till macOS 11. Xcode 10+ installs some command line file in different locations compared to previous releases. If you already installed FPC under a previous Mac OS X/OS X/macOS version, you will have to reinstall FPC 3.2.2 under macOS 10.14 to get a configuration file that enables the compiler to find the necessary files). See also the section below on how to install the command line tools.

Xcode 5+ compatibility (OS X 10.9 and later; for OS X 10.8, see below)

FPC 3.2.2 is qualified for use with Mac OS X 10.4 till macOS 11. Xcode 5 and later however no longer install the command line tools by default, which are required by FPC. To install them manually, open "/Applications/Utilities/Terminal", execute

xcode-select --install

and choose "Install". Afterwards, FPC will function correctly.

Xcode 4.3-5.x compatibility (Mac OS X 10.7/OS X 10.8)

FPC 3.2.2 is qualified for use with Mac OS X 10.4 till macOS 11. Xcode 4.3 and later however no longer install the command line tools by default, which are required by FPC. To install them manually, open Xcode, go to Preferences, select "Downloads;" and install the "Command Line Tools". Afterwards, FPC will install and function correctly.

Xcode 3.2.x-4.2 compatibility (Mac OS X 10.6)

FPC 3.2.2 is qualified for use with Mac OS X 10.4 till macOS 11. There is however 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.

Download the 3.2.2 release in 1 big file:

  • fpc-3.2.2.intelarm64-macosx.dmg (274 MB) contains an installation package for compiling Intel (32 bit and 64 bit) and ARM64 programs.
  • fpc-3.2.2.intel-macosx.cross.powerpc-macosx.dmg (132 MB) contains an add-on installation package for compiling PowerPC (32 and 64 bit) programs.
  • fpc-3.2.2.intel-macosx.cross.ios.dmg (184 MB) contains an installation package for compiling iPhone/iPod Touch/iPad programs.
  • fpc-3.2.2.intel-macosx.cross.jvm.dmg (12 MB) contains an add-on installation package for compiling JVM programs.

Back to mirror list
Back to general download page

How to Install Free Pascal on a Mac OS X Computer

Note: if you find a problem with these instructions, please
send me an e-mail message at

The first step is that you need to install something called Xcode.
Xcode is available on your OS X CD, so just insert that CD in
your computer, and then install Xcode.

Xcode is also available via the Internet:

http://developer.apple.com/tools/xcode/index.html

Just click on "Download Xcode 2.2" .

After installing Xcode:

* go to www.freepascal.org

* click on Download (on the left side of the window)

* click on Mac OS X

* click on ftp.freepascal.org

* click on fpc-2.0.2.powerpc-macosx.dmg

This should start the download.

After the download is complete, install the program.
Just click on the new icon to start the installation ...
and the installation should proceed automatically
[please let me know if I am wrong about this].

After the installation is complete:

* [Thanks to Daniel H. Steinberg for the next instructions.]

Start up a new "terminal" window.
You can find "terminal" in Mac OS X/Applications/Utilities/.
You may find it useful to drag Terminal to your dock. When
the terminal starts up you should see a prompt that looks
something like this:

[localhost:~] <user name>%

* please type this command in this new window, and press ENTER:

/usr/local/bin/fpc

* You should see a long message (which mentions Free Pascal).
In fact, the message should ask you to press the Enter key,
to display the rest of the message.

If that is the case, then the installation worked - success!

But: if the message says "command not found" .... that is not good.

--------------------------------------------------------------------------
Part 2: Using Free Pascal to Create Programs

--- The "bash profile" file ----

[Thanks to Daniel H. Steinberg -- I copied some of these instructions
from his Internet documents.] Open up the Terminal application. You can find this
in Mac OS X/Applications/Utilities/. You may find it useful to drag Terminal to
your dock. When Terminal starts up you should see a prompt that looks like this:

[localhost:~] <user name>%

Please carefully type this command:

vi .bash_profile

[please note the "dot" and the "underscore" in the command]

This starts up the "vi" editor program. "vi" is a weird program!
So, instead of explaining it completely, I'm just going to walk
you through a few commands.

Next, press "i". [You won't see an "i" on the screen -- that's OK.]

Next, please type this EXACTLY:

PATH=$PATH:/usr/local/bin:.

Next, press the Esc key.

Next, please type this:

:wq

... and then press ENTER.

That should cause "vi" to exit ... and you should see the "command prompt" again:

[localhost:~] <user name>%

Now, let's see if all this worked. Close the terminal window, and open up
a new terminal window. Of course, you should see the "command prompt".
Please type this command:

fpc

You should see a long message (which mentions Free Pascal).
In fact, the message should ask you to press the Enter key,
to display the rest of the message.

If that's the case, then please continue with the rest of this document.

But: if the message says "command not found" .... that is not good.
You may want to try this step one more time, from the beginning.
----------------------------------------------------------------------------
A New Folder: ECS15

In your terminal window, please enter this command:

mkdir ECS15

This creates a new ECS15 folder, under your "home" folder.

Change to that folder:

cd ECS15
----------------------------------------------------------------------------
Text Edit

[These instructions are a little rough, since I don't have a Mac,
and I'm just going from memory. If anyone would like to make
these instructions more precise, and then send them to me, that
would be great!]

Now, leave the terminal window open, but please start up a program
called "Text Edit". You'll find it in Mac OS X/Applications.

After it starts up, go to the Format Menu, and choose "Make Plain Text".

Next, please type in the following sample program (or cut and paste):

program hello;
begin
writeln('Hello, world.')
end.

Next, you want to save the file. Select "Save As" .... and
when the little window pops up, try to find your new ECS15
folder. You may have to click on some of the black arrows.
And you may have to click on your "home" folder, so that
you can see the ECS15 folder.

For the file name, please use "hello.pas". Whenever you create
a Pascal program, you'll need to use .pas in the file name.

After you click on Save, the computer may ask you if you
want a different extension. But the extension you want is .pas
---------------------------------------------------------------------------
Ready to Compile

Now, leave the Text Edit window open, but go back to the Terminal window.

There, please type this command: ls

The "ls" command lists all the files and folders in the current folder.
You should see your "hello.pas" file in the list.

Next, please type this command: fpc hello.pas

The "fpc" command invokes the Free Pascal Compiler, which translates
your Pascal program to a form that the computer can understand.

You should see some messages that look something like this:

Free Pascal Compiler version 2.0.0 [2005/08/17] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: OS X
Compiling hello.pas
Linking hello
4 Lines compiled, 0.6 sec

Now type this command: hello

That will *run* your new program, which should simply
print this message:

Hello, world.

That's all it does. If that worked, great -- so far, so good.
----------------------------------------------------------------------------
Another program

Use Text Edit to create another file. (Remember to use the Format
Menu and select "Make Plain Text").

program Sample;
var
n1, n2, sum: integer;
begin
writeln('Enter two numbers:');
readln(n1,n2);
sum := n1 + n2;
writeln('The sum is ', sum);
end.

Save this file in your ECS15 folder as well. Please name it "sum.pas".

Go back to the Terminal window, and try to compile the new file:

fpc sum.pas

* You should see several messages, like this:

Free Pascal Compiler version 2.0.0 [2005/05/08] for i386
Copyright (c) 1993-2005 by Florian Klaempfl
Target OS: OS X
Compiling sum.pas
Linking sum.exe
8 Lines compiled, 0.1 sec

* However, you might instead see some "error messages".

If so, then check your program (in the Text Edit window) for errors.
After you fix them, be sure to save your file again, and then
go back to the terminal window, and try to compile again using
the fpc command.

* Try to run the program (in the Terminal window).

Type this command: sum

Your program should print this message:

Enter two numbers:

Go ahead and enter 2 numbers (separated by a space), then press ENTER,
and then your program should report the sum of the numbers.

* If that works, great! You are done. Feel free to close
all windows.

* Note: there is nothing to turn in for this exercise!
However, this exercise is excellent practice for
the first programming assignment.