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 the most simple method that I've personally found.
   
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 but they were all outdated, complicated, or simply didn't work. I ended up finding this method on my own 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 guide was made specifically for the Garry's Mod version of Hammer. It's possible other versions will work too, but I can't guarantee anything.

  • This method might still work if you're running Wayland, but during my tests I found the 2D views to be extremely laggy to the point where they were unusable. I'm using an Nvidia GPU though so you might have better results with AMD or Intel.

  • 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 accordingly.
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.

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]

The specific version of Wine you download could make a huge difference. Older versions do not seem to work well with Hammer. I'm currently using version 9.8, which works great, but it's a new unstable development version, so it may not be immediately available on your distro. The 9.0 stable release might work too, but I haven't tested it. 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 /home/[user]/.steam/steam/steamapps/common/GarrysMod/bin. Leave everything else unchanged for now. You'll need to come back and set the Wine prefix later, since it will need generated before you can set it, assuming you don't already have one.

Under the "Runner options" tab, set the Wine version to 9.8, 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.

If you haven't set a Wine prefix yet, you will need to generate one now. To do this, select the newly created Hammer entry in Lutris, and click play. After a few seconds you should see a small popup that says something like "Generating Wine prefix in /home/[user]/.wine". Pay close attention to where it's generating the prefix, as it could be different than mine. Once the popup goes away, the generation is likely done. Wine might launch Hammer from there, but in my experience it won't. If it doesn't, you will need to go back into the Hammer Lutris config and set the "Wine prefix" option that I mentioned earlier, to the path of the prefix that was just generated.

Once you set the prefix path, you should be able to launch and use Hammer through Lutris.
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.

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.

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.
6 Comments
OPGman  [author] 25 Jul @ 7:13am 
ok
2homezz 25 Jul @ 1:04am 
im a linux user, i have no idea what hammer is. (dont tell me what it is i dont wanna know anyway)
OPGman  [author] 23 Jul @ 3:23pm 
Thanks! If anyone manages to find a better method or gets Hammer running on a different Wine version than what's mentioned here, let me know and I'll update the guide.
Nik1 23 Jul @ 2:15am 
Finally a genuinly good tutorial compared to other meme tutorials that aren't even funny (atleast to me, its fine if you like them).
Thanks for the tutorial, I hope more linux users that like to make maps for Garry's mod will find it!
func_arf 17 Jul @ 9:40pm 
This will be useful when I build my new tower, thanks.
MateCRO 13 Jul @ 5:49am 
This will come in hand for when I switch, thank you kind internet stranger :Blessing: