To build FiveM, RedM or FXServer on Windows you need the following dependencies:
-
A Windows machine with Visual Studio 2019 (Build Tools/Community is fine) installed with the following workloads:
- .NET desktop environment
- Desktop development with C++
- Universal Windows Platform development
You can install these workloads by going to "Tools" -> "Get Tools and Features..." -> Check the checkboxes -> Click "Modify" in the bottom right corner.
-
PowerShell 7 or higher.
-
Python 3.8 or higher with the
py
launcher installed. -
MSYS2 at
C:\msys64\
which is where the installer places it.
Then, execute the following commands in a cmd.exe
shell to set up the build environment:
git clone https://github.com/citizenfx/fivem.git -c core.symlinks=true
cd fivem
git submodule update --jobs=16 --init
:: If you're using Python 3.12 or higher you may need to install setuptools
:: pip install setuptools
:: downloads the right Chrome version for 64-bit projects
fxd get-chrome
:: or -game server/-game rdr3/-game ny
fxd gen -game five
fxd vs -game five
After building the FiveM client, you should be having files such as /code/bin/five/debug/v8.dll
exist automatically. Manual copying is no longer required.
Symlink game-storage
directory (optional)
The /code/bin/five/debug/data/game-storage
directory can get quite large and is equivalent to the %LocalAppData%/FiveM/FiveM.app/data/game-storage
directory, so you should use a symlink to save disk space.
If you don't know how to do that, here's how:
- Navigate to
/code/bin/five/debug
. - Delete the
game-storage
folder indata
if it already exists. - Make a new
data
directory if it doesn't already exist. - Hold Shift, right click empty space in
/code/bin/five/debug/data
, and select "Open PowerShell window here". - Type this:
New-Item -ItemType SymbolicLink -Path "game-storage" -Target "$env:localappdata/FiveM/FiveM.app/data/game-storage"
. - You should now see a
game-storage
folder inside/code/bin/five/debug/data
.
Known issues
-
Game starts but all I see is the main menu background, my cursor and (when I press F8) a console!
This directory is probably missing:
/code/bin/five/debug/citizen/ui
.UI building might have failed, but you can copy this directory
%LocalAppData%/FiveM/FiveM.app/citizen/ui
from your main installation of FiveM. -
Windows error code 126, or some issues with other DLLs.
It's possible that you accidentally missed a step or skipped a file that should have been copied. Start this section over from scratch; do not pass go, do not collect £200.
-
Windows error code 127.
Add an antivirus exclusion for the repository, try rebuilding, and see if it works this time.