MacOS Dev Environment for Garry's Mod in 2017

This guide will cover setting up a cozy little developer environment for Garry's Mod in 2017!

This guide will be using OS X as it's my OS of choice for development, but most of this guide translate to the other operating systems.

Requirements

Setup

We want to get coding and iterating efficiently ASAP! To be efficient, any knowledgable programmer will want an editor that has syntax highlighting for her language of choice. A bonus would be a linter for basic error and formatting catching as we type.

Luckily, we've been provided with both by the famous @FPtje!

Installing GMod Syntax Highlighting

First package we're installing is the syntax highlighting.

  1. Open Sublime Text
  2. Open the command palette (CMD/CTRL+SHIFT+P)
  3. Type install and press enter
  4. Search for GMod and press enter

We'll also need to fix a couple of Sublime Text conflicts for this to function.

  1. Go to Preference -> Settings - User
  2. Add a comma after the last setting
  3. Paste the following line: "ignored_packages": ["Vintage", "Lua"]

You may already have this configuration, if so, just add on to it! Congrats, we have GMod Lua syntax highlighting!

Installing glualint

Next we're going to install the linter for GMod Lua. Linting is the process of running a program that will analyze code for potential errors.

This will be a bit more in-depth as this package has some Haskell prerequisites. I'll cover compiling glualint since we're on OS X.

  1. Install Haskell Platform I recommend installing with homebrew cask.
  2. Install 'nix' with brew cask install nix
  3. Open a terminal and make a project folder to compile the linter in: mkdir glualint
  4. Change directories into your project folder: cd glualint
  5. Clone glualint git clone git@github.com:FPtje/GLuaFixer.git
  6. Run nix-build pkg.nix. This could take a while. This is a good time to brew another batch of your favorite caffeine. 😉
  7. Assuming we have no build errors, the linter should be in
    result/bin/glualinter. Congrats, we compiled the linter!
  8. We need to add the linter to our $PATH variable with
    export PATH="~/glualint/result/bin:$PATH" && source ~/.bash_profile

Confirm everything was installed by running glualint --version.
If you have errors, try troubleshooting here.

Installing SublimeLinter-glualint

  1. Open Sublime Text
  2. Open the command palette (CMD/CTRL+SHIFT+P)
  3. Type install and press enter
  4. Search for glualinter and press enter

All set to get developing!

If you're running Garry's Mod on MacOS, you won't reap the benefits of auto refreshing Lua.

In future posts I'll cover how to setup a git source control workflow for Garry's Mod so we can take advantage of the auto refresh feature on a Linux server or Windows machine!

The Windows version of this tutorial is also in the works.

Notes

If you found this article helpful and do choose to run with Digital Ocean, please consider using my referral link:

When you use this link and bill $25, I get $25 dollars towards my server costs! I'd really appreciate you and it would help me continue to pay for the server I use to produce these guides in my spare time! ♥

Comment

Ethan Trawick

I like shiny things! Follow me @Otoris

I get around. http://otoris.com/

Subscribe to Otoris' Blog

Get the latest posts delivered right to your inbox.

or subscribe via RSS with Feedly!