You can easily update any lazarus installation using git. Even lazarus installations you installed, e.g. through an installer (also on windows)
If your lazarus directory is not yet a git directory, first initialize git (skip if it's already a git repository):
git init
git remote add origin https://gitlab.com/freepascal.org/lazarus/lazarus.git
Now you can fetch the all the new branches and versions:
If you want to change from a stable version to another stable version, you can switch the branch. E.g. if you want to update form the current version (e.g. 3.6) to 4.0rc1:
git reset --hard tags/lazarus_4_0_RC_1
git checkout tags/lazarus_4_0_RC_1
If instead you are already on main/trunk but just want to update to the newest commit just do:
git reset --hard origin/main
Note, the reset resets all changes, if you want to save them do a stash before
git stash
# reset and/or checkout
git stash pop
Now your directory is on the desired version you can rebuild:
make clean
make lazbuild PP=$(realpath ../fpc/bin/fpc) # change to fpc.sh for fpcup installation
./lazbuild --build-ide=
Note that you must choose the correct path for the make lazbuild. If you use the system fpc you don't need to add any PP=..., if you have a custom fpc installation choose that one. FPCUp usually installs fpc as fpc.sh into the parent folders fpc/bin
This is actually how I update pretty much all of my lazarus installations, including on windows where I installed them with the windows installer.