Getting started with Nintendo Switch homebrew development

Getting started with Nintendo Switch homebrew development

You have modded your Switch with a custom firmware (hopefully DeepSea) and want to write your own little program but don't know where to start? You are not the only one stuck in a flood of guides, forum posts and YouTube videos that show you how to get a massive headache. But don't worry - we will go through it and set you up in minutes!

The only thing that is a requirement for this is Docker. If you don't know what docker is, then you should definitely look it up. But to give you a general idea, you can imagine Docker as a hyper performant virtual machine that works on a huge number of operating systems. Thats not really it but it helps to shape the idea of it.

Git is good to have for version control, storing source code online and collaborative development in your project. On Windows and Mac you can use GitHub Desktop for a userfriendly UI, but i wont go into more detail because its not nessesary to get you started.

For this guide i will assume that you are a windows user and can use Docker Desktop with its nice UI.

Go ahead and install Docker (desktop). Once that is done, start it and you will be greeted by something that looks like this (minus the already existing images):

If it looks like this, the Docker-engine has started and is ready to do its job. If it doesn't look like this (again, ignore the already existing images) then you might have to wait a few more minutes.

Open the start-menu, type "cmd" and press enter. A terminal window will appear. The only command to download, configure and run the switch development environment is docker run --name SwitchDevEnv -i -d -v /c/Users/YOUR_USERNAME/Documents/SwitchEnvironment:/home -p 28280:28280 devkitpro/devkita64

Looks confusing at first but i'll quickly explain what it does.

  • docker run --name SwitchDevEnv starts a container (the built environment from an image) with the name "SwitchDevEnv"
  • -i means its interactive and the container does not shut down once the specified task is finnished
  • -d means detatched, so it doesnt give you a terminal of the container within the terminal you opened
  • -v /c/Users/Slluxx/Documents/SwitchEnvironment:/home - this one is important. It maps a folder of your pc into the docker container. The files you put there can be accessed and changed by it, which is important so we dont need to download project files "into" the container. After compiling a project we also have a way to copy the homebrews out of there. Make sure you change your username (in my case "Slluxx") to your own username. Not exiting folders will be created for you.
  • -p 28280:28280 is for networking and maps your pc port 28208 to the container port 28208. This is not needed but usefull if you want to use netloader to test your homebrew instead of transferring stuff manually or via ftp.
  • devkitpro/devkita64 this is the "image" that we create a running environment on. Its basically a bunch of files and instructions that will get build into a linux environment.

Once the command is done working, you have a proper switch development environment, all configured and ready to go in a neat docker container. No loose files on your harddrive and nothing to worry about. If you don't want to develop homebrews anymore, you can simply delete the container and image and it will be like nothing has ever existed!

Here is a quick video of me setting it up. Its not a tutorial but just shows the process.

You are now ready to download the example homebrews (here is a direct link to the zip) that you can extract into the folder you have specified when creating the docker container. In my case it will look like this:

These folders will now be available in your docker container. Open up Docker Desktop, click on "containers" and then click on the container we created. If you didnt change the name, it should be "SwitchDevEnv". At the top you will now see 4 tabs. Click on "Terminal" and you should see this:

This is where you compile your homebrew. Type su to get some features like tab-autocompletion and other stuff, which just makes your life a little easier. Now type cd /home and then ls. You should see a list of all the example homebrews that you can compile.

Pick an example homebrew, for example cd /home/hid/touch-screen and run the command make -j. It will compile the sourcecode into a file named touch-screen.nro, which you can copy to and start on your Nintendo Switch.

You have just compiled your first homebrew!

There is much more to learn and to explain but it's a little beyond the scope of this article. If you have questions, you can ask me on Discord or start a new post in the GBATemp forum. Everyone there is super helpful and it's a great place to be in.