Author Topic: Lazarus IDE portable  (Read 1582 times)


  • Full Member
  • ***
  • Posts: 142
Lazarus IDE portable
« on: October 13, 2021, 10:33:56 am »
Is any version of Lazarus fully portable (Windows based)?


  • Hero Member
  • *****
  • Posts: 3510
Re: Lazarus IDE portable
« Reply #1 on: October 13, 2021, 11:07:26 am »
Is any version of Lazarus fully portable (Windows based)?
Almost fully portable. There are two conditions:

1. Install Lazarus with FPCUpDeluxe, let's say to c:\developer\lazarus
2. On the other computer you have to preserve the directory structure: c:\developer\lazarus, so you cannot copy the lazarus folder to d:\test\ for example

You could pull of the same thing with a standard installation, but it's much more difficult.


  • Sr. Member
  • ****
  • Posts: 481
Re: Lazarus IDE portable
« Reply #2 on: October 13, 2021, 12:44:28 pm »
Both Lazarus and FPC uses config files to locate needed files.  The trick then is to save these config files inside the Lazarus folder which I assume will be portable, extract the drive + folder name on the host computer when drive is connected, then use this information to locate the config files.  The next trick would be to rewrite the folders in the config files so that they expand to include the mounted drive on the host computer.

So my proposal (I haven't tested this) is to use a batch file to launch Lazarus.  This batch file (located in the root of the Lazarus folder with lazarus.exe) first extracts its own location using %~dp0, then call the Lazarus executable, passing the path to its config file using the --pcp option:

Code: Text  [Select][+][-]
  1. set lazroot=%~dp0
  2. %lazroot%lazarus.exe --pcp=%lazroot%lazconfigfolder

The fpc.cfg file still needs to be edited to make all paths relatieve to %lazroot%.  Also this assumes fpc.cfg is located in the bin folder where the compiler binary is (true for default Lazarus install I think).  This assumes the folder structure of a standard Lazarus+FPC install.  I'm not sure if there are installed files that end up in the system folder, but I doubt that.

Again, this is just an untested suggestion, corrections & improvements are welcome.


  • Full Member
  • ***
  • Posts: 144
Re: Lazarus IDE portable
« Reply #3 on: October 13, 2021, 01:33:47 pm »
There are tons of absolute paths in the config files, at least judging from a search in the config files of an fpcupdeluxe installation.

I have once managed to move such an existing installation to a different folder without breaking it, but I needed to do a recursive search replace for the old path in all text files, and these were hundreds of ocurences in dozens of files.

I am thinking about making myself a tool that can replace all these paths with a placeholder (and the other way around) with the click of a button while zipping the entire Lazarus installation (or only the configuration files¹) to move it somewhere else.

¹ While working with different installations made with fpcupdeluxe I often felt the need to copy my entire Lazarus config from an existing installation to a new one (different branch for example). This tool should therefore also have the option to only replace/zip/unzip/unreplace the configuration files and leave everything else alone.


  • Hero Member
  • *****
  • Posts: 9021
Re: Lazarus IDE portable
« Reply #4 on: October 13, 2021, 02:27:47 pm » is a tool which does all the adjustments to make a Lazarus installation fully portable. Not tested by myself...
Mainly Lazarus trunk / fpc 3.2.0 / all 32-bit on Win-10, but many more...


TinyPortal © 2005-2018