Garry's Mod

Garry's Mod

Not enough ratings
Using Hammer on Linux
By OPGman
This guide will explain how to use the Hammer editor on Linux using what is likely to be the simplest method out there.
   
Award
Favorite
Favorited
Unfavorite
Introduction
I've spent quite a while trying to find a way to run Hammer on Linux. I found several methods online but they were all outdated, complicated, or simply didn't work. I ended up finding this method by chance while testing a bunch of different things.

This is probably one of the most if not the most simple method. It does not require you to download an SDK, download the Windows version of Steam, use SteamCMD, or do much manual configuration (compared to other methods anyway).

Notes
  • Just because this method works for me, doesn't mean it will work for you. Results may vary between distros, software versions, and possibly even hardware.

  • This guide assumes that you already know the basics of Linux and Hammer. If you don't, there's plenty of resources out there for both.

  • This method has been tested for Garry's Mod, Black Mesa, and Counter-Strike: Source. Other games will likely work as well but I can't guarantee anything.

  • If you end up finding an easier method or different Wine version not mentioned here that works, let me know and I'll update the guide.
Installing Garry's Mod
Garry's Mod has a native Linux version, but Hammer and the rest of the SDK tools are not shipped with it, so you will need to force Steam to download the Windows version. There are several ways to do this, but the easiest way is to simply right click the game in your library, click Properties, click the Compatibility tab, and enable the checkbox that says "Force the use of a specific Steam Play compatibility tool".

You can then select a Proton version from the drop down menu. I recommend either Proton Experimental or the latest version of Proton GE if you have that installed. You won't be using this to run Hammer, so choose whichever version you think works best for running Garry's Mod itself. Once you select a Proton version, Steam should automatically start downloading the Windows version of the game.
Installing Lutris & Wine
The main piece of software you'll need is Lutris. This program allows you to run Windows software on Linux through a variety of different configurations, and has an easy to use GUI. It's mainly intended for games, but it works just as well with regular software. Using Bottles instead of Lutris might also work, but I won't be covering it since I don't use it.

Click here to view the Lutris installation instructions for your distro.[lutris.net]

You will also need to ensure that Wine gets installed, since it's responsible for actually running Hammer. Depending on what distro and package manager you're using, Wine might get automatically installed alongside Lutris. For example, in the Manjaro software manager, Wine shows up as an optional dependency that you can select to be installed with Lutris. If this isn't the case for you, you'll have to install it manually.[github.com]

NOTE: If you're using Wayland, you might be better off using a recent Proton version instead due to a bug that causes the 2D views to lag. Unfortunately, you will most likely experience flickering in the 2D views no matter what you choose, but at least they'll be usable.

The specific version of Wine you download could make a huge difference. Older versions do not seem to work well with Hammer. The oldest version that seems to work is 9.0, and anything newer should also work just as well. The older 8.x releases and the special Lutris versions did not work for me.
Adding Hammer to Lutris
The next step is to configure Hammer to be launched from within Lutris. In the top left corner of Lutris, click the plus (+) button, then click "Add locally installed game".

You should now see a window to configure a new game. Under the "Game info" tab, set the Name value to something fitting such as Hammer or Valve Hammer Editor, and set the Runner option to Wine.

Under the "Game options" tab, click the browse button next to the Executable option and select the hammer.exe file, which by default should be in ~/.steam/steam/steamapps/common/GarrysMod/bin. Leave everything else unchanged for now.

Under the "Runner options" tab, set the Wine version to 9.0, or whatever your newest version is. You might have to play around with this option to see which version works the best. You can also try Proton as well. Everything else here as well as everything in the "System options" tab can be left unchanged. Click save in the top right corner.

Next you can set a path for the Wine prefix. This is basically a virtual Windows drive that Hammer will use to store information such as recently opened files and view sizes. If you don't set one, it will be generated at ~/.wine, which is okay, but I personally recommend giving every program in Lutris its own prefix, in case you need to regenerate it for some reason. If you wish to do this, set the prefix path to an empty folder of your choice.

Once you set the prefix path, save the settings and launch Hammer through the Play button within Lutris. You should see a message stating that it's generating the Wine prefix. You might have to launch Hammer a second time for it to actually load once the prefix is generated.
Troubleshooting
Missing gameinfo.txt error
If you got this error, then congrats, you technically got Hammer working! Now you just need to edit a config that tells Hammer where to look for the rest of the game files. Navigate to the same bin directory that the hammer.exe is located in, and open the file named "GameConfig.txt".

Hammer is running within a Wine prefix, so it's looking for Windows paths rather than Linux paths. To have Hammer access files located in your Linux file system, you will have to go through the virtual Z: drive. For example, the GameDir path usually looks something like this: "C:\Program Files (x86)\Steam\steamapps\common\GarrysMod\garrysmod", and it needs to be changed to something like this: "Z:\home\[user]\.steam\steam\steamapps\common\GarrysMod\garrysmod". These paths could be different for you depending on where you have Garry's Mod installed, but hopefully you get the idea. Every path with a drive letter in the GameConfig.txt file needs to be changed into this new format.

Hammer crashes or freezes when opening a map
This is most likely caused by an incompatible Wine or Proton version. Keep trying different versions until it works. It might also be worth trying to roll back or update your video driver and switching between X11 and Wayland, if possible.

Views are glitched and unusable
This is either caused by an incompatible Wine/Proton version, or an improper configuration within Hammer. Check your Hammer options and ensure every option within the Game Configurations tab is set properly. Also make sure all of the file paths in the GameConfig.txt file are set properly.

Views constantly flicker when interacting with them
This is something I've experienced running Hammer with Proton on X11, and on Wayland with both Wine and Proton. Unfortunately, there's currently no fixes that I'm aware of, other than to use Wine on X11.

Game won't launch when running map
When the game is launched from inside the Wine prefix, it tries to detect Steam, and closes if it can't find it. You can technically fix this by installing the Windows version of Steam into the prefix, but it's much easier to just launch the game through Steam on Linux and load the map manually after compiling. You'll probably run into even more issues trying to run the game through Wine instead of Proton anyway.

Game or Hammer won't launch or update
There are three possible causes that myself and others have experienced. 1) The game is installed to a different drive than Steam. 2) The game and Steam are installed to an encrypted drive or home directory. Steam in particular is known to have issues with this. 3) The game's prefix is corrupted and needs to be deleted and regenerated.
29 Comments
Chillyroom Jan 30 @ 4:29pm 
I see well im using dwm is that why it like this ?
OPGman  [author] Jan 30 @ 7:23am 
The potential fixes for the glitched views are listed in the troubleshooting section. I don't know if setting it to win32 would make any difference but you can certainly try.
Chillyroom Jan 30 @ 4:49am 
btw now i have glitched out views,im using wineprefix=win64 shall i make it win32 ?
Chillyroom Jan 30 @ 4:28am 
I CAME BACK AND GOOD NEWS I FOUND A FIX !
for all of you linux users please make sure your gmod is on the same disk as steam is installed in otherwise the game will always have problems including this

i just moved my files into / disk and hammer worked just fine plus the game proton update completed just fine didn't get stuck

to the author of this guide please add this to your troubleshoot section or to a new guide whatever you want,thank you so much for making me able to run the game!

spread the word and thanks to you all wonderful linux community <3
Chillyroom Jan 28 @ 10:44pm 
AHAAAA NOW I GET IT THANK YOU SO MUCH!
OPGman  [author] Jan 28 @ 11:05am 
The GameDir path needs to be a Windows path like the other ones. If I understand correctly it seems like you're trying to use Windows binaries with the Linux version of the game. You can't use the Linux version of the game at all for this.
Chillyroom Jan 27 @ 4:41pm 
"Configs"
{
"Games"
{
"Garry's Mod"
{
"GameDir" "/media/Liquid/SteamLibrary/steamapps/common/GarrysMod/garrysmod"
"Hammer"
{
"GameData0" "Z:\mEdiA\Liquid\StEAmLibrAry\stEAmApps\common\GArrysMod\bin\gArrysmod.fgd"
"GameData1" "Z:\media\Liquid\SteamLibrary\steamapps\common\GarrysMod\bin\garrysmod.fgd"
"TextureFormat" "5"
"MapFormat" "4"
"DefaultTextureScale" "0.250000"
"DefaultLightmapScale" "16"
Chillyroom Jan 27 @ 4:32pm 
aha that's what I did and i got the config ready
for exec i put the directory of where hl_linux is
for gameinfo.txt i put as wanted
but what's left is database where can I find but ill post what i did on gameconfig.txt
OPGman  [author] Jan 26 @ 8:12pm 
Yea the Linux version lacks pretty much all of the SDK content so you need to download the Windows version through Steam.
Chillyroom Jan 26 @ 8:08pm 
hmmm i see....i basically downloaded the windows bin from the depot and copied into the linux one and it worked,just ran tho not working so ill try to get your way to get hammer.exe