Q100576: How to set the default application used to open .nk files to either Nuke or NukeX

SUMMARY

When launching Nuke scripts by double-clicking the icon, they generally launch with the latest installed version. This article explains how to update the default settings to open .nk scripts using any specified version, and which Nuke product it launches, either Nuke or NukeX.

 

MORE INFORMATION

Launching Nuke by double-clicking the script can save time, and when doing so, the user expects a specific version or product to open. The following dropdowns provide information on specifying a Nuke application and version for their respective operating system.

Windows

In Windows, one method to update the Nuke scripts is by editing the file Properties for Opens with and selecting the correct application. To enable launching Nuke 17.1v1 as a default application when double-clicking a .nk file, please perform these steps:

This procedure can also be used for .hrox Nuke Studio/Hiero project files if desired.

  1. Locate and right-click a Nuke script that has the .nk file extension
  2. In the context menu select Properties
  3. Click Change... to choose from a list of applications
  4. Select a Nuke application from the list, or if needed select Look for another app on this PC, and choose any installed Nuke application as a preference:

    windows_appselect.png

Double-clicking the .nk scripts will now open it with the specified default application.

macOS

On macOS, the process is different than Windows for setting the default launch application. Please perform the following to update the default Nuke application and when double-clicking the .nk script:

This procedure can also be used for .hrox Nuke Studio/Hiero project files if desired.

  1. Locate and right-click a Nuke script that has the .nk file extension
  2. In the context menu select Get Info
  3. Click the Open With section to expand it
  4. Select the application dropdown and choose any installed Nuke application as a preference:

  5. Click Change All… and then Continue to set the default application:

Double-clicking the .nk script will now open it with the selected default application.

Please keep in mind that the default application settings on macOS are only changed per User Account.

Linux

For the Linux distributions, Nuke has its own mime type (application/x-nuke), which will need to be added to a file list in a specific directory before double-clicking .nk scripts will be able to launch Nuke. More information on this can be found in the Further Reading section. Please perform the following to launch .nk scripts on the Linux platform:

Please keep in mind that this was tested on CentOS 7/Rocky 9 with the GNOME desktop environment. Other desktop environments and file locations may vary. 

  1. Using any terminal text editor (such as nano or vim), and create a file called “applications-x-nuke.xml” in the /usr/share/mime/packages directory, like with the following example command:

    sudo nano /usr/share/mime/packages/applications-x-nuke.xml
  2. Copy/paste the following code into the .xml file:

    <?xml version="1.0" encoding="UTF-8"?>
    <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
     <mime-type type="application/x-nuke">
      <comment>NukeScript</comment>
      <glob pattern="*.nk"/>
     </mime-type>
    </mime-info>
  3. Save and exit the .xml file (Ctrl+S, then Ctrl+X in nano)
  4. Update the mime database to ensure it takes effect:

    sudo update-mime-database /usr/share/mime
  5. Then update the application database:

    sudo update-desktop-database /usr/share/applications 
  6. Copy the created .xml file to ~/.local/share/mime/packages/ with the command:

    sudo cp /usr/share/mime/packages/applications-x-nuke.xml ~/.local/share/mime/packages/

There’s a chance that the /mime/packages/ directory is not already available. In this instance, run the following command to create the directories first, before copying the file over: mkdir -p ~/.local/share/mime/packages/

  1. Update the mime database for that location:

    sudo update-mime-database ~/.local/share/mime
  2. Update the application database:

    sudo update-desktop-database ~/.local/share/applications
  3. Log out of the current user, and then log back in to apply any changes made.

There may be errors related to other Linux mime-types when updating the mime databases, as shown in the screenshot below. These can be ignored for the purpose of creating the applications/x-nuke mime type. Please view the Further Reading section for more information on the update-mime-database and update-desktop-database commands.

 

As of Nuke 12, Nuke no longer creates shortcuts when being installed, so shortcuts will need to be created manually. A feature request to change this behavior is logged as: ID 162266 - Add the ability to control which Desktop Icons are installed/added to the desktop

More information about creating shortcuts on Linux can be found here: Q100521: How to create a desktop shortcut for Foundry software on Linux operating systems

Shortcuts can be created by:

  1. Using any terminal text editor (such as nano or vim), and create a file called “Nuke17.1v1.desktop” in the /usr/share/applications/ directory, like with the following example command:

    sudo nano /usr/share/applications/Nuke17.1v1.desktop
  2. Copy/paste the following lines into the file:

    [Desktop Entry]
    Name=Nuke17.1v1
    Comment=
    Exec="/usr/local/Nuke17.1v1/Nuke17.1" --nuke -b %f
    Terminal=false
    MimeType=application/x-nuke;
    Icon=/usr/local/Nuke17.1v1/plugins/icons/NukeApp48.png
    Type=Application
    Categories=Graphics;2DGraphics;RasterGraphics;FLTK;
  3. Save and exit the .desktop file (Ctrl+S, then Ctrl+X in nano)

 

It may also be necessary to add or adjust the application/x-nuke mime type in the mimeapps.list. Please edit the list with the following command in terminal: nano ~/.config/mimeapps.list

Then if they are not already present , please add the following line to both the [Added Associations] and [Default Applications] list for your latest version of Nuke, as shown in the screenshot below:

application/x-nuke=Nuke17.1v1.desktop;

 

The .nk script should now be associated with the desired application, and when double-clicked, launch the correct version.

As an alternative method in Linux with the GNOME desktop, and as long as the mime-type was registered, you can perform the following for opening the .nk script with Nuke as a default application:

  1. Right-click the associated file type (.nk)
  2. Select Open With Other Application
  3. Click any Nuke or NukeX application and press Select

Please keep in mind that doing this method may change the behavior of other default applications of the same type (i.e plain text document). If you do not want other text files opened with Nuke, instead of setting it as Default, just right-click the Nuke Script and select Open with Application > Nuke, or set the mime-type from the first method.

 

FURTHER READING

 

FURTHER HELP

If you are still experiencing issues after trying the provided steps above, please open a Support request and let us know the exact issue encountered and the troubleshooting steps that have been taken. 

For more information on how to open a Support request, please refer to this article: Q100064: How to raise a support ticket

    We're sorry to hear that

    Please tell us why