Skip to content

Instantly share code, notes, and snippets.

@joshenders
Last active October 8, 2024 15:00
Show Gist options
  • Save joshenders/4e43259eb641ce2342dea9416154c2c1 to your computer and use it in GitHub Desktop.
Save joshenders/4e43259eb641ce2342dea9416154c2c1 to your computer and use it in GitHub Desktop.
Getting started with Nintendo Switch Development using devkitpro on macOS

Getting started with Nintendo Switch Development using devkitpro on macOS

Prerequsite: Ensure Xcode command line tools are installed

xcode-select --install

Install the devkitpro Package Manager

  1. Download the latest devkitpro-pacman-installer.pkg from the GitHub releases page.

  2. Install it with:

    sudo installer -pkg /path/to/devkitpro-pacman-installer.pkg -target /

Install the libraries and tools for switch development

Install the switch-dev package group using dkp-pacman.

sudo dkp-pacman --noconfirm --sync switch-dev

Update your shell runtime configuration

  1. Create ~/.bash_profile or edit it if you have one already and add the following envrionment variables:

    export DEVKITPRO=/opt/devkitpro
    export DEVKITARM="${DEVKITPRO}/devkitARM"
    export DEVKITPPC="${DEVKITPRO}/devkitPPC"
    export PATH="${DEVKITPRO}/tools/bin:${PATH}"
  2. Source your updated ~/.bash_profile

    source ~/.bash_profile

Your first build

Devkitpro comes with example code installed at ${DEVKITPRO}/examples. You can use this code to test your toolchain or as a boiler plate for your first project.

cp -r "${DEVKITPRO}/examples/switch/templates/application" /tmp/example
cd /tmp/example
make

You should now have a file in the current directory called example.nro.

Using NetLoader and nxlink to test your build

  1. Launch the hbmenu using your favorite method. I'm partial to the RCMLoader myself.

    hbmenu

  2. Ensure that your Switch is connected to Wifi (not in Airplane mode) and press 'Y' to start NetLoader

    netloader

  3. In your build directory, run nxlink with the IP address shown on the NetLoader screen:

    nxlink --address 192.168.1.10 example.nro
  4. You should see your example code running.

    example

License

This work is licensed under CC BY-NC version 4.0 https://creativecommons.org/licenses/by-nc/4.0/ © 2020, Josh Enders. Some Rights Reserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment