Skip to main content

A simple terminal shortcut on MacOS to open files and folders in Arduino IDE

One feature of VSCode that I like is the ability to open files and directories easily from the command line.

$ cd ~/path/to/website

$ code .

This opens the website folder in VSCode, ready for development :)

I was hoping the Arduino IDE may have shipped a similar feature, but unfortunately, no dice. So here is a simple bash script you can add to your .zshrc file to do just that!

$ nano ~/.zshrc
arduino() {
    if [ -z "$1" ]; then
        # If no path is given, open the current directory
        open -a "Arduino IDE" .
    else
        # Otherwise, open the specific file or folder provided
        open -a "Arduino IDE" "$1"
    fi
}

Now you can open the current directory in the Arduino IDE:

$ arduino

Or open a speciic sketch file

$ arduino blink.ino

Happy coding 👨🏻‍💻