How to Install AutoHotkey on Ubuntu 24.04

AutoHotkey (AHK) is a powerful scripting language that allows you to automate tasks and remap keys in Windows. Unfortunately, it’s not natively supported on Linux. But don’t worry! With a few tweaks, you can get AutoHotkey running on Ubuntu 24.04 using Wine. Let’s walk through the process step by step.

Step 1: Install Wine

Since AutoHotkey is a Windows application, you’ll need Wine to run it on Linux. Wine is a compatibility layer that allows you to run Windows applications on Linux.

  1. Open your terminal and update your package list:
    • sudo apt update
  2. Install Wine:
    • sudo apt install wine64 wine32
  3. Verify the installation by checking the Wine version:
    • wine --version

You should see output showing the installed version of Wine.

Step 2: Download AutoHotkey

Next, we’ll download the AutoHotkey installer from the official website.

  1. Visit the AutoHotkey download page.
  2. Download the AutoHotkey_2.x.x_setup.exe file to a folder on your Ubuntu system.

Step 3: Install AutoHotkey using Wine

Now that you have Wine installed and the AutoHotkey setup file downloaded, it’s time to install AHK.

  1. In the terminal, navigate to the directory where you downloaded the AHK installer. For example:
    • cd ~/Downloads
  2. Run the installer using Wine:
    • wine AutoHotkey_2.x.x_setup.exe
  3. Follow the on-screen instructions to complete the installation. Once installed, AutoHotkey will be available to use with Wine.

Step 4: Running AutoHotkey Scripts

To run an AHK script, follow these steps:

  1. Create or download a .ahk script.
  2. Right-click on the script file and choose “Open With” > “Wine Windows Program Loader.”Alternatively, you can run the script from the terminal using the following command:
    • wine AutoHotkey.exe /path/to/your/script.ahk

Step 5: Optional – Create a Shortcut for AutoHotkey

To make launching AutoHotkey more convenient, you can create a desktop shortcut.

  1. Create a new .desktop file in the applications directory:
    • sudo nano /usr/share/applications/autohotkey.desktop
  2. Add the following content to the file:iniCopy code[Desktop Entry] Name=AutoHotkey Exec=wine /path/to/AutoHotkey.exe Type=Application Icon=wine
  3. Save and close the file.

Now you can launch AutoHotkey from your applications menu.

While AutoHotkey isn’t officially supported on Linux, using Wine allows you to enjoy the flexibility and power of AHK scripts on Ubuntu 24.04. Whether you’re remapping keys or automating tasks, you now have the tools to get started.