OK, Enrico, lets get this clear. Earlier Trev showed you some code that you built with fpc, it was to test that there was no problem with you writing to your Desktop.
I got the impression that you are building another bit of source, something that uses FileUtils the same way. You said -
then I added
fpc unit1.pas
which is the name of the unit of the program. Here I encountered this error:
Free Pascal Compiler version 3.0.4 [2019/11/01] for x86_64
Copyright (c) 1993-2017 by Florian Klaempfl and others
Target OS: Darwin for x86_64
Compiling unit1.pas
unit1.pas(8,22) Fatal: Can't find unit FileUtil used by Unit1
Fatal: Compilation aborted
Error: /usr/local/bin/ppcx64 returned an error exitcode
I don't understand why it "Can't find unit FileUtil used by Unit1" ?
That sounds, to me that you are building that source with fpc on the command line, not Lazarus within the IDE.
Lazarus provides the IDE (Integrated Development Env) and, importantly a whole lot of (mostly) GUI libraries or units in pascal speak. When you use Lazarus, it adds the paths to all those extra units and when you build, the pretty complicated command line to fpc is all organised for you.
If you are using the Lazarus IDE, you might be building a GUI app and you will be telling the Lazarus IDE where all the thing you need are and, when you press the green triangle, Lazarus will put all that info together to do the building.
Sorry that was so long winded but it sounds to me that there is some confusion about what we are talking about ! If I still have it wrong, please say so, I'll be no use to you unless I understand what you are doing.
enricobonetti@Enricos-Air Library % cd ~/Library/Lazarus/components/lazutils
cd: no such file or directory: /Users/enricobonetti/Library/Lazarus/components/lazutils
Hmm, are you sure that is where the units should be ? I am sorry, currently travelling and don't have my mac with me so cannot see where mine are. But if you think that where you expect them, try moving up the line a bit and see, for example if ~/Library is there, next, see if ~/Library/Lazarus and so on, will expose a typo.
From within Lazarus, you can go to Tools->Options and the field labeled "Lazarus Directory (default for all projects)" is the one that should point to the directory that has the "components/lazutils/" directory, the one you are looking for.
If Lazarus has an entry for that field, "Lazarus Directory (default for all projects)" that is not really there, it sure won't work. It could be that you have accidentally changed that field or maybe installed Lazarus somewhere else. In either case, that setting must point to where the content really is.
Davo